Skip to content

Commit

Permalink
Chore: add script to site that remove service-worker (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Nov 23, 2022
1 parent 2d46741 commit ced6fc3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/.vitepress/public/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// https://github.com/NekR/self-destroying-sw
/* globals self */
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)
})
})

0 comments on commit ced6fc3

Please sign in to comment.