mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-25 05:58:16 +03:00
25 lines
769 B
JavaScript
25 lines
769 B
JavaScript
|
// DON'T REMOVE THIS FILE: IT IS THE OLD sw.js
|
||
|
self.addEventListener('install', (e) => {
|
||
|
self.skipWaiting();
|
||
|
});
|
||
|
self.addEventListener('activate', (e) => {
|
||
|
self.registration.unregister()
|
||
|
.then(() => self.clients.matchAll())
|
||
|
.then((clients) => {
|
||
|
clients.forEach((client) => {
|
||
|
if (client instanceof WindowClient)
|
||
|
client.navigate(client.url);
|
||
|
});
|
||
|
return Promise.resolve();
|
||
|
})
|
||
|
.then(() => {
|
||
|
self.caches.keys().then((cacheNames) => {
|
||
|
Promise.all(
|
||
|
cacheNames.map((cacheName) => {
|
||
|
return self.caches.delete(cacheName);
|
||
|
})
|
||
|
);
|
||
|
})
|
||
|
});
|
||
|
});
|