Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const CACHE_NAME = 'cache-v1';
- const precacheResources = [
- '/',
- 'index.html',
- 'styles/main.css',
- 'images/space1.jpg',
- 'images/space2.jpg',
- 'images/space3.jpg'
- ];
- self.addEventListener('install', event => {
- console.log('Service worker install event!');
- event.waitUntil(
- caches.open(CACHE_NAME)
- .then(cache => {
- return cache.addAll(precacheResources);
- })
- );
- });
Add Comment
Please, Sign In to add comment