-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.js
More file actions
40 lines (33 loc) · 735 Bytes
/
sw.js
File metadata and controls
40 lines (33 loc) · 735 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// $ID: worker.js, 28 Nov 2018, 13:23, Leonid 'n3o' Knyazev $
/* eslint-disable */
const DEBUG = false;
self.addEventListener('install', event => {
if (DEBUG) {
console.info('[SW]: Install event');
}
});
self.addEventListener('activate', event => {
if (DEBUG) {
console.info('[SW]: Activate event');
}
});
self.addEventListener('message', event => {
if (DEBUG) {
console.info('[SW]: Message event');
}
switch (event.data.action) {
case 'skipWaiting':
if (self.skipWaiting) {
self.skipWaiting();
self.clients.claim();
}
break;
default:
break;
}
});
self.addEventListener('fetch', event => {
if (DEBUG) {
console.info('[SW]: Fetch event');
}
});