Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathservice-worker.js
More file actions
Latest commit
50 lines (48 loc) · 1.42 KB
/
Copy pathservice-worker.js
File metadata and controls
50 lines (48 loc) · 1.42 KB
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
43
44
45
46
47
48
49
50
varCACHE_NAME='index'
varurlsToCache=[
'/',
'index.html',
'styles/styles.css',
'images/icon-72x72.png',
'images/icon-96x96.png',
'images/icon-128x128.png',
'images/icon-144x144.png',
'images/icon-152x152.png',
'images/icon-192x192.png',
'images/icon-256x256.png',
'images/icon-384x384.png',
'images/icon-512x512.png',
'images/background.jpg',
'images/logo.svg',
'images/favicons/apple-touch-icon-57x57.png',
'images/favicons/apple-touch-icon-60x60.png',
'images/favicons/apple-touch-icon-72x72.png',
'images/favicons/apple-touch-icon-76x76.png',
'images/favicons/apple-touch-icon-114x114.png',
'images/favicons/apple-touch-icon-120x120.png',
'images/favicons/apple-touch-icon-144x144.png',
'images/favicons/apple-touch-icon-152x152.png',
'images/favicons/apple-touch-icon-180x180.png',
'images/favicons/apple-touch-icon.png',
'images/favicons/favicon-16x16.png',
'images/favicons/favicon-32x32.png',
'images/favicons/favicon.ico',
'images/favicons/safari-pinned-tab.svg'
]
self.addEventListener('install',event=>{
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache=>{
console.log('Opened cache')
returncache.addAll(urlsToCache)
})
)
})
self.addEventListener('fetch',event=>{
console.log(event.request.url)
event.respondWith(
caches.match(event.request).then(response=>{
returnresponse||fetch(event.request)
})
)
})