place for SW API • SW is a separate file • SW can’t be registered from other domain • https is required, but localhost is white-listed • SW doesn’t have access to main app context • in real world we need to check if SW is supported: if ('serviceWorker' in navigator)
new API for network requests. It is based on Promise. Say “bye-bye” to callback based XHRs. • Fetch promise .catch() is executed when network is unavailable • Response - API for working with network responses • Response has stream nature so it can be read only once. . clone()method is used to overcome this.
every service worker file update • Service Worker file is considered updated when it changes in size • Activate event can be used to clean up the old version stuff • Service Worker has two update modes - cold (default) and hot
step • set service worker to waiting state • release old worker when all the pages with current active worker are closed • run activate step when page with app is opened • take control over the page • ==> it’s like Google Chrome update model!
Is Service Worker Ready? by Jake Archibald: https://jakearchibald.github.io/isserviceworkerready/ • Introduction To Service Worker on HTML5 Rocks : http://www.html5rocks.com/en/tutorials/service-worker/introduction/ • Service Worker Libraries maintained by Google: https://developers.google.com/web/tools/service-worker-libraries/