- [Narrator] So we are back in our code.…In this case, it's 0503, the begin folder,…and I'm currently in the browser.…So let's see what we have.…We have a service worker that is currently…activated and running.…And we have an HTML that has a button.…That if I click the button, it seem to be sending…a message to the service worker.…The problem is: no one is actually receiving…that message. So let's go to the code.…In the code, now we are going to the service…worker file…And we need to add a new event listener.…
So we have "install," we have "activate,"…we have "fetch," and now we are going to add a new one.…So it's self.addEventListener…and the event name is "message."…We are going to create a narrow function…that will receive the event argument…and we should receive the message sent by the page.…And that message is available in event.data.…So the message is event.data.…Because we have established a communications protocol,…we know that that object should contain…an action property.…
So we're going to make a switch.…
- 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 Advanced
Web Portfolio Projects: Binding and Propagationwith Leigh Lawhon1h 9m 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.