-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsworker.js
78 lines (68 loc) · 1.52 KB
/
vsworker.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var Vone = 'vrixe1.10';
var urlts = [
'/app/pwa.html',
'/app/allmenu.html',
'/app/api.html',
'/app/why_we_dont_have_apps.html',
'/app/vlog4x.png',
'/manifest.json',
'/app/vlogfour.png',
'/app/icons/pwa.png',
'/app/icons/android-logo.png',
'/app/icons/windows-logo.png',
'/app/icons/apple-logo.png',
'/app/icons/download-logo.png',
'/app/pwa_wall.jpg',
'/app/stap.jpeg',
'/app/iosaction.png',
'/app/vlogreq.png',
'/app/vlogpwa.png',
'/app/terms.html',
'/app/css/pwa.css',
'/app/pwascript.js',
'/app/pwalog.html',
'/app/fonts/gg.ttf',
'/fall.html'
];
/* service worker bit only / updated Jan 19 2020*/
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open(Vone).then(function(cache) {
console.log('App Files Cached');
return cache.addAll(urlts);
}));
});
self.addEventListener('activate', function(e){
e.waitUntil(
caches.keys().then(keyList => {
return Promise.all(keyList.map(key => {
if (key !== Vone){
return caches.delete(key);
}
}));
}));
});
/* OR
self.addEvent Listener('activate', function(e){
e.waitUntil(
caches.keys().then(function(urlts) {
return Promise.all(sap
urlts.map(function (Vone) {
if (Vone !== 'vrixe2.15') {
return caches.delete(Vone);
}
})
)
})
);
});
*/
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
}).catch(function() {
return caches.match('/fall.html');
})
);
});