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

14 lines
333 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) => {
2022-11-16 22:39:20 +01:00
clients.forEach((client) => client.navigate(client.url))
})
})