-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
37 lines (35 loc) · 939 Bytes
/
sw.js
File metadata and controls
37 lines (35 loc) · 939 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
36
37
const hadankySiteV1 = "hadanky-site-v1"
const assets = [
"/",
"/main.js",
"/game.html",
"/index.html",
"/info.html",
"/data/images/bears.jpg",
"/data/images/camaro.jpg",
"/data/images/candle.jpg",
"/data/images/eagle.jpg",
"/data/images/flamingos.jpg",
"/data/images/hummingbird.jpg",
"/data/images/nemo.jpg",
"/data/images/octopus.jpg",
"/data/images/seal.jpg",
"/data/images/tajmahal.jpg",
"/data/tasks.json",
"/styles/style.css",
"/styles/print.css"
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(hadankySiteV1).then(cache => {
cache.addAll(assets).then(r => console.log(r))
})
)
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})