mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Update sw.js
This commit is contained in:
parent
3c32812292
commit
cb4b436d8c
21
sw.js
21
sw.js
@ -1,11 +1,24 @@
|
|||||||
self.addEventListener('install', function(e) {
|
self.addEventListener('install', function(e) {
|
||||||
console.log('script install')
|
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('activate', function(e) {
|
self.addEventListener("activate", function (event) {
|
||||||
console.log('script activate')
|
event.waitUntil(
|
||||||
self.registration.unregister()
|
caches.keys().then(function (cacheNames) {
|
||||||
|
return Promise.all(
|
||||||
|
cacheNames
|
||||||
|
.filter(function (cacheName) {
|
||||||
|
// Return true if you want to remove this cache,
|
||||||
|
// but remember that caches are shared across
|
||||||
|
// the whole origin
|
||||||
|
})
|
||||||
|
.map(function (cacheName) {
|
||||||
|
return caches.delete(cacheName);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
self.registration.unregister()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return self.clients.matchAll();
|
return self.clients.matchAll();
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user