What is a Service Worker?

Service Workers are defined as a script that your browser runs behind the scenes, separate from the main browser threads. It can intercept network requests, interact with a cache (either storing or retrieving information from a cache), or listen to and deliver push messages. This carries a couple of caveats, too. It is fully asynchronous, so that means anything that requires synchronous operations, such as XMLHttpRequest (XHR) or operating with localStorage, cannot be used inside the Service Worker code. It can also do some other neat tricks, such as receiving push messages even when the app itself is not active, allowing you to display notifications to the user even when the app is not open!

Since it can intercept network requests and store/retrieve information from a server, it can also operate when offline, which allows your application to start up and be used immediately, and progressively fetch updates or update periodically in the background from the server!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset