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.
Work with the registration - JavaScript Tutorial
From the course: JavaScript: Service Workers
Work with the registration
- [Instructor] I'm in 02_07 > Begin project and I'm inside the index.html. When we were registering the serviceWorker, we need to remember that we receive a promise. When that promise give us the callback when that promise was fulfilled, we're going to receive a registration object. That object is important because there are several events that we combine to the registration, also there are some properties that we can listen to, for example, when we check the registration object, we can verify if there is an actual active serviceWorker currently available and it will give us the active serviceWorker. So, for example, we can listen to events for that serviceWorker such as onerror or onstatechange in the case that serviceWorker, for example, is going to be replaced by a new one. Also we can check its scriptURL and current state. Active is not the only serviceWorker that we can check. We can also check if there is any waiting serviceWorker. That's another serviceWorker with the same API…
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
-
-
-
-
-
-