-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsw.js
55 lines (52 loc) · 1.24 KB
/
sw.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(function () {
const CACHE_NAME = 'beeroclock-site-cache';
const urlsToCache = [
'/',
'/index.html',
'/404.html',
'/style/base.css',
'/style/site.css',
'/js/clock.js',
'/js/data.js',
'/js/index.js',
'/js/swreg.js',
'/js/text.js',
'/js/tools.js',
'/img/beer.png',
'/img/apple-touch-icon.png',
'/img/favicon.ico',
'/img/favicon-16x16.png',
'/img/favicon-32x32.png',
'/img/favicon-48x48.png',
'/img/favicon-64x64.png',
'/img/favicon-96x96.png',
'/img/favicon-128x128.png',
'/img/favicon-144x144.png',
'/img/favicon-152x152.png',
'/img/favicon-192x192.png',
'/img/favicon-384x384.png',
'/img/favicon-512x512.png',
'/img/mstile-150x150.png',
'/img/safari-pinned-tab.svg',
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME)
.then((cache) => {
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request)
.then((response) => {
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});
})();