-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice-worker.js
38 lines (36 loc) · 1.05 KB
/
service-worker.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
const workerCache = "math-tools-app-v1-0-3"
const assets = [
"/",
"/index.html",
"/style.css",
"/manifest.json",
"/assets/calc.js",
"/assets/functions.js",
"/assets/images/logo.svg",
"/assets/images/logo_96.ico",
"/assets/images/logo_96.png",
"/assets/images/logo_256.png",
"/assets/images/logo_512.png",
"/assets/images/logo_720.png",
"/assets/images/logo_1024.png",
"/assets/images/math_background.svg",
"/assets/images/phytagoras.svg",
"https://unpkg.com/akar-icons-fonts",
"https://unpkg.com/[email protected]/dist/aos.js",
"https://unpkg.com/[email protected]/dist/aos.css",
"https://fonts.googleapis.com/css2?family=Mali:wght@300;400;500;600;700&family=Open+Sans:wght@400;500;600;700;800&display=swap"
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(workerCache).then(cache => {
cache.addAll(assets)
})
)
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})