- [Instructor] Back in our California project…we have already saved all the files in the cache,…but no one is serving those files.…So we actually need to listen…for the fetch event handler,…the same that we did before.…And we're going to do this,…we are going to respond with,…and we need to respond with…a promise of a response…or an actual response.…So we need to go to the cache and see if it's there.…
So to go to the cache we need to use caches.match.…Caches.match will look for a request in that cache,…and it will return a promise…with the found object if it was found.…For example in this case we want to search for the request…that the browser is actually asking for.…So event.request,…and we're going to match that request.…In this case we are not saying in which…cache we want to search,…so this API will look into…all the caches available in our origin.…
So if we want to specify exactly the cache,…we can also do that first.…Opening the cache and then executing match…inside the cache object.…But let's do it simple first.…
- 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.