Skip to content

Commit cb4b436

Browse files
authored
Update sw.js
1 parent 3c32812 commit cb4b436

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

sw.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
self.addEventListener('install', function(e) {
2-
console.log('script install')
32
self.skipWaiting();
43
});
54

6-
self.addEventListener('activate', function(e) {
7-
console.log('script activate')
8-
self.registration.unregister()
5+
self.addEventListener("activate", function (event) {
6+
event.waitUntil(
7+
caches.keys().then(function (cacheNames) {
8+
return Promise.all(
9+
cacheNames
10+
.filter(function (cacheName) {
11+
// Return true if you want to remove this cache,
12+
// but remember that caches are shared across
13+
// the whole origin
14+
})
15+
.map(function (cacheName) {
16+
return caches.delete(cacheName);
17+
})
18+
);
19+
})
20+
);
21+
self.registration.unregister()
922
.then(function() {
1023
return self.clients.matchAll();
1124
})

0 commit comments

Comments
 (0)