- [Instructor] Let's open the project in O2_03, Begin.…And I'm now in the serviceworker.js file,…which is currently empty.…Inside this file,…we don't have the global context that we are used to,…but we do have for example the same console options…that we used to, so we can say "We are a service worker"…One of the most important things to do within…a service worker is to listen to events.…To listen to events in a worker, including service worker,…we typically use the self option.…
The self option, it's similar to this,…but in this case it's not going to change…when you are working with ES6 classes.…So self, we can add EventListener.…For example, from the life cycle that we have seen before,…we can use activate…and install.…So I'm going to add two listeners,…one for install, one for activate.…Inside this event for now,…we are just going to send messages to the console.…
So console.log, Install event.…And console.log, Activate event.…Remember, both events have to do…with the installation process.…I'm going to save the file,…
- Service worker life cycle
- Registering service workers
- Handling service worker events
- Updating service workers
- Acting as a network proxy
- Configuring cache storage
- Communicating with clients
- Optimizing web performance
Skill Level Intermediate
1. A New Citizen for the Web
2. Work with Service Workers
3. Acting as a Network Proxy
4. Cache Storage
5. Work with APIs in the Service Worker
6. Tips and Tricks for Web Performance
Next steps1m 55s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.