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

16 lines
378 B
JavaScript
Raw Normal View History

2022-11-16 22:39:20 +01:00
// 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))
})
})