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