JavaScript: Pill 1kB library.


This article is about Pill library which adds dynamic content loading to static sites
and makes content loading smooth for users and also at the end of this article, I have share  Interview Questions.

The development of Pill started with this tweet:
https://twitter.com/sitnikcode/status/1109626507331338240
Its size is 1kB when minified and gzipped.

Nowadays, everybody uses a single page application(SPA).
SPA is a web application where the page is loaded only once throughout
the session but the web components will keep loading as per the user action or the business process.
But for the static page's website, there is no need to use SPA.
We can use the traditional approach of multi-page application and for that purpose, Pill
library will be one of the good solutions.

It fetches the content of other HTML files on the server and replaces the current content with the new, fetched one which leads to massive performance improvements.
It does not request a whole new page, just the important content is replaced and this is done automatically.
Yuss, It uses AJAX internally.
Also, it is documented pretty well with a great example.
so make sure to check everything out.

Example Link: https://rumkin.github.io/pill/

Github Link: https://github.com/rumkin/pill/tree/master/example

Here are some of the Interview Questions that were asked to me for the position of Angular Developer(For those who don't know):

Interviewer: Why should we use Angular?
Ans: One of my answers was, we can make a single page application using angular.

Interviewer: So before Angular, it was not possible to make a SPA?
Ans: My answer was no. (Which was wrong. We can use AJAX to make an application to behave like SPA with rich user experience.)

Detail:
Before AJAX most web sites would round-trip to the server to reload the page on most interactions.
There were very few sites/applications that felt dynamic the way the web does today.
AJAX was one such technology that changes everything. It added a rich user experience.

AJAX: Is the method of exchanging data with a server and updating parts of a web page,
without reloading the entire page.

I hope you like this article.

Please do share your feedback in the comments section.
Subscribe this blog for more articles on Node.js and JavaScript.
You can also follow me on Twitter or Linkedin for the latest updates.

Written By:
Saurabh Joshi

Comments

Popular Posts