-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceworker.js
49 lines (47 loc) · 1.43 KB
/
serviceworker.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
let resources = [
'/Werwolf/werwolf.html',
'/Werwolf/style.css',
'/Werwolf/werwolf-data.js',
'/Werwolf/manifest.json',
'/Werwolf/icons/wolf.png',
'/Werwolf/icons/townsfolk.png',
'/Werwolf/icons/werewolf.png',
'/Werwolf/icons/witch.png',
'/Werwolf/icons/seer.png',
'/Werwolf/icons/cupid.png',
'/Werwolf/icons/harlot.png',
'/Werwolf/icons/add_player.png',
'/Werwolf/icons/norole.svg',
'/Werwolf/icons/Skull and Void.otf'
];
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('werwolf').then(function(cache) {
return cache.addAll(resources);
})
);
});
self.addEventListener('fetch', e => {
e.respondWith(
caches.match(e.request).then(res => {
return res || fetch(e.request).then(response => {
return caches.open('werwolf').then(cache => {
cache.put(e.request, response.clone());
return response;
});
});
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(resp) {
return resp || fetch(event.request).then(function(response) {
return caches.open('werwolf').then(function(cache) {
cache.put(event.request, response.clone());
return response;
});
});
})
);
});