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

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)
}
})
})