-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceworker.js
31 lines (29 loc) · 867 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
const staticDevCoffee = "dev-coffee-site-v1"
const assets = [
"/",
//Add Your All files with Correct Path here and also it is better to add your logo images and fonts
"/app.js",
"/style.css",
"/manifest.json",
"/serviceworker.js",
"android/android-launchericon-512-512.png",
"android/android-launchericon-192-192.png",
"android/android-launchericon-144-144.png",
"android/android-launchericon-96-96.png",
"android/android-launchericon-72-72.png",
"android/android-launchericon-48-48.png",
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticDevCoffee).then(cache => {
cache.addAll(assets)
})
)
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})