mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
self destroying service worker
* https://github.com/NekR/self-destroying-sw
This commit is contained in:
parent
ae25714987
commit
3fed18fc6c
14
static/sw.js
Normal file
14
static/sw.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
self.addEventListener('install', function() {
|
||||||
|
self.skipWaiting()
|
||||||
|
})
|
||||||
|
|
||||||
|
self.addEventListener('activate', function() {
|
||||||
|
self.registration
|
||||||
|
.unregister()
|
||||||
|
.then(function() {
|
||||||
|
return self.clients.matchAll()
|
||||||
|
})
|
||||||
|
.then(function(clients) {
|
||||||
|
clients.forEach(client => client.navigate(client.url))
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user