forked from ButlerFuqua/pwa_bare_minimum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
25 lines (23 loc) · 630 Bytes
/
sw.js
File metadata and controls
25 lines (23 loc) · 630 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
self.addEventListener("install", e => {
e.waitUntil(
caches.open("static").then(cache => {
return cache.addAll([
"./",
"./src/master.css",
"./images/logo192.png"
])
})
)
})
self.addEventListener('fetch', e => {
e.respondWith(
caches.match(e.request)
.then(response => {
return response || fetch(e.request)
})
.catch(error => {
console.log(`There was an error intercepting the fetch response.`)
console.log(error)
})
)
})