From the course: JavaScript: Service Workers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Update the service worker - JavaScript Tutorial
From the course: JavaScript: Service Workers
Update the service worker
- [Instructor] After we have registered the Service Worker, in the future we usually want to change it with new code, so we need to think about this for a minute. When the Service Worker is going to be updated because the Service Worker is installed in users' devices. It works when the user is offline. So, the browser has a checking algorithm that is basically a byte-by-byte comparison in the service worker file. Some browsers are also making that byte-by-byte comparison in all the scripts used by ImportScripts. We can force an update from develop tools and also the browser will fire automatically that algorithm at some points but it can also be fired by an API, for example, we can have a user interface with an update button that will force the browser to make the check at that point. The API is pretty simple. When we have the registration object, we just call update and that will force the browser to try to go and run the checking algorithm. So, the algorithm is different per browser…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Register a service worker4m 22s
-
(Locked)
Change the default scope3m 53s
-
(Locked)
Handle service worker events2m 50s
-
(Locked)
Debug with Developer Tools in Chrome5m 51s
-
(Locked)
Debug with other browsers3m 18s
-
(Locked)
Load external files3m 6s
-
(Locked)
Work with the registration5m 52s
-
(Locked)
Update the service worker5m 36s
-
(Locked)
Manage updates in your code4m 24s
-
(Locked)
Unregister the service worker3m 22s
-
-
-
-
-
-