-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsw.js
30 lines (28 loc) · 849 Bytes
/
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
const CACHE = "precache-v6";
const precacheFiles = [
/* Add an array of files to precache for your app */
"/timer/index.html",
"/timer/assets/img/icons/icon-180x180.png",
"/timer/assets/img/icons/icon-192x192.png",
"/timer/assets/img/icons/icon-512x512.png",
"/timer/assets/css/style.css",
"/timer/assets/js/screenfull.min.js",
"/timer/assets/js/timer.js",
"/timer/assets/audio/beep.mp3",
"/timer/assets/audio/beep.ogg",
];
self.addEventListener('install', function (event) {
event.waitUntil(
caches.open(CACHE).then(function (cache) {
return cache.addAll(precacheFiles);
})
);
});
self.addEventListener('fetch', function (event) {
console.log(event.request.url);
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
})
);
});