Service Worker Opening A New World For Web App

Service worker gives us access to the various features like push notifications and background sync and in future, they will provide geofencing.

Service worker is a script, a JavaScript that runs in the background of the browser. It runs separately from a web page that allows us to enable all those features that do not need any user or web page interaction.

They are created with a motive to provide to better offline experience to the people, intercepts the network request and take actions based on the network and update elements of the servers if it is required.

Few points to remember about service worker:

  • They do not have DOM access, as it is a JavaScript worker.
  • They are a network proxy that is programmable too.
  • They terminate themselves when not in use and restart whenever needed.
  • They use promises extensively.
  • They will make a website work offline and reduces the network requests too.

Service worker lifecycle is quite different from that of the webpage. Here are the few links where you can learn how to create service workers: