mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
16 lines
352 B
JavaScript
16 lines
352 B
JavaScript
// https://github.com/NekR/self-destroying-sw
|
|
self.addEventListener('install', (e) => {
|
|
self.skipWaiting()
|
|
})
|
|
|
|
self.addEventListener('activate', (e) => {
|
|
self.registration
|
|
.unregister()
|
|
.then(() => self.clients.matchAll())
|
|
.then((clients) => {
|
|
for (const client of clients) {
|
|
client.navigate(client.url)
|
|
}
|
|
})
|
|
})
|