-
Notifications
You must be signed in to change notification settings - Fork 277
/
Copy pathsw.js
32 lines (28 loc) · 918 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// sw.js - This file needs to be in the root of the directory to work,
// so do not move it next to the other scripts
const CACHE_NAME = 'lab-7-starter';
// Once the service worker has been installed, feed it some initial URLs to cache
self.addEventListener('install', function (event) {
/**
* TODO - Part 2 Step 2
* Create a function as outlined above
*/
});
/**
* Once the service worker 'activates', this makes it so clients loaded
* in the same scope do not need to be reloaded before their fetches will
* go through this service worker
*/
self.addEventListener('activate', function (event) {
/**
* TODO - Part 2 Step 3
* Create a function as outlined above, it should be one line
*/
});
// Intercept fetch requests and store them in the cache
self.addEventListener('fetch', function (event) {
/**
* TODO - Part 2 Step 4
* Create a function as outlined above
*/
});