October 2017
Intermediate to advanced
302 pages
7h 27m
English
When our service worker installs, we want to go ahead and set up our cache, and begin caching the relevant assets. So, our step-by-step guide to our install event goes like this:
Let’s open up firebase-messaging-sw.js and get to work!
If you still have the console.log event listener for install, great! Delete the console.log; otherwise, set it up as follows:
self.addEventListener('install', function() {});
Right above this function, we’ll also assign our cache object name to a variable:
const CACHE_NAME = ‘v1’;
This name can be literally anything, but we'll want to up the version every time we ...
Read now
Unlock full access