Skip to content

Commit 4fe60b1

Browse files
committed
docs: add sw clearer
1 parent 3058a5a commit 4fe60b1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: docs/public/service-worker.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// force clearing previous service worker
2+
self.addEventListener('install', function (e) {
3+
self.skipWaiting()
4+
})
5+
6+
self.addEventListener('activate', function (e) {
7+
self.registration
8+
.unregister()
9+
.then(function () {
10+
return self.clients.matchAll()
11+
})
12+
.then(function (clients) {
13+
clients.forEach((client) => client.navigate(client.url))
14+
})
15+
})

0 commit comments

Comments
 (0)