1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00
portfolio/public/sw.js

16 lines
352 B
JavaScript
Raw Normal View History

2022-11-16 22:39:20 +01:00
// https://github.com/NekR/self-destroying-sw
self.addEventListener('install', (e) => {
2022-11-16 22:39:20 +01:00
self.skipWaiting()
})
self.addEventListener('activate', (e) => {
2022-11-16 22:39:20 +01:00
self.registration
.unregister()
.then(() => self.clients.matchAll())
.then((clients) => {
2024-07-26 13:43:45 +02:00
for (const client of clients) {
client.navigate(client.url)
}
2022-11-16 22:39:20 +01:00
})
})