We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3c32812 commit cb4b436Copy full SHA for cb4b436
sw.js
@@ -1,11 +1,24 @@
1
self.addEventListener('install', function(e) {
2
- console.log('script install')
3
self.skipWaiting();
4
});
5
6
-self.addEventListener('activate', function(e) {
7
- console.log('script activate')
8
- self.registration.unregister()
+self.addEventListener("activate", function (event) {
+ event.waitUntil(
+ caches.keys().then(function (cacheNames) {
+ 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()
22
.then(function() {
23
return self.clients.matchAll();
24
})
0 commit comments