-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsw.js
30 lines (29 loc) · 793 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
var cacheurl = [
'/simple-compass/',
'/simple-compass/index.html',
'/simple-compass/index.js',
'/simple-compass/index.css',
'/simple-compass/Compass.png',
'/simple-compass/icon-192.png',
'/simple-compass/icon-512.png',
'/simple-compass/needle.png',
'/simple-compass/dark.webmanifest',
'/simple-compass/favicon.ico'
];
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open('simple-compass')
.then(cache => {cache.addAll(cacheurl);})
.then(self.skipWaiting())
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});
self.addEventListener("onupdatefound", function () {
registration.update();
})