mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
29 lines
765 B
JavaScript
29 lines
765 B
JavaScript
self.addEventListener('install', function(e) {
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener("activate", function (event) {
|
|
event.waitUntil(
|
|
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() {
|
|
return self.clients.matchAll();
|
|
})
|
|
.then(function(clients) {
|
|
clients.forEach(client => client.navigate(client.url))
|
|
});
|
|
});
|