Skip to content

Commit ced6fc3

Browse files
authored
Chore: add script to site that remove service-worker (#2047)
1 parent 2d46741 commit ced6fc3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// https://github.com/NekR/self-destroying-sw
2+
/* globals self */
3+
self.addEventListener('install', (e) => {
4+
self.skipWaiting()
5+
})
6+
7+
self.addEventListener('activate', (e) => {
8+
self.registration
9+
.unregister()
10+
.then(() => self.clients.matchAll())
11+
.then((clients) => {
12+
for (const client of clients) client.navigate(client.url)
13+
})
14+
})

0 commit comments

Comments
 (0)