-
Notifications
You must be signed in to change notification settings - Fork 0
/
serviceWorker.js
42 lines (38 loc) · 899 Bytes
/
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
const pwrscript = "pwrscript-v1"
/*
const assets = [
"/",
"/index.html",
"/static/css/clock.css",
"/static/css/navbutton.css",
"/static/css/search.css",
"/static/js/background.js",
"/static/js/clock.js",
"/static/js/navbutton.js",
"/static/js/offlinedetect.js",
"/static/js/redirect.js",
"/static/js/search.js",
"/static/img/background0.gif",
"/static/img/background1.gif",
"/static/img/background2.gif",
"/static/img/moon.png",
"/static/img/sun.png",
"/static/img/pwrscript.png",
]
*/
const assets = [
]
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(pwrscript).then(cache => {
cache.addAll(assets)
})
)
})