-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserviceworker.js
More file actions
35 lines (33 loc) · 895 Bytes
/
serviceworker.js
File metadata and controls
35 lines (33 loc) · 895 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
34
35
const staticDevCoffee = "agecalculus-v1";
const assets = [
"/",
"/index.html",
"style.css",
"index.js",
"manifest.json",
"/assets/images/logo.png",
"/assets/images/icon-arrow.svg",
"/assets/images/favicon-32x32.png",
"/assets/images/icon-72x72.png",
"/assets/images/icon-96x96.png",
"/assets/images/icon-128x128.png",
"/assets/images/icon-144x144.png",
"/assets/images/icon-152x152.png",
"/assets/images/icon-192x192.png",
"/assets/images/icon-384x384.png",
"/assets/images/icon-512x512.png",
];
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(staticDevCoffee).then((cache) => {
cache.addAll(assets);
})
);
});
self.addEventListener("fetch", (event) => {
event.respondWith(
caches.match(event.request).then((res) => {
return res || fetch(event.request);
})
);
});