-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserviceWorker.js
More file actions
33 lines (31 loc) · 819 Bytes
/
Copy pathserviceWorker.js
File metadata and controls
33 lines (31 loc) · 819 Bytes
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
const staticDevCache = 'dev-mini-blackjack-v1';
const assert = [
"/",
"/index.html",
"/main.js",
"/styles.js",
"/blackjackIcon.png",
"/images/icons/icon-48x48.png",
"/images/icons/icon-72x72.png",
"/images/icons/icon-96x96.png",
"/images/icons/icon-128x128.png",
"/images/icons/icon-144x144.png",
"/images/icons/icon-152x152.png",
"/images/icons/icon-192x192.png",
"/images/icons/icon-384x384.png",
"/images/icons/icon-512x512.png",
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticDevCache).then(cache => {
cache.addAll(assert);
})
);
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request);
})
);
})