]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: force clear service worker
authorEvan You <yyx990803@gmail.com>
Mon, 7 Feb 2022 06:00:49 +0000 (14:00 +0800)
committerEvan You <yyx990803@gmail.com>
Mon, 7 Feb 2022 06:00:49 +0000 (14:00 +0800)
docs/public/service-worker.js [new file with mode: 0644]

diff --git a/docs/public/service-worker.js b/docs/public/service-worker.js
new file mode 100644 (file)
index 0000000..a9097e2
--- /dev/null
@@ -0,0 +1,15 @@
+// force clearing previous service worker
+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))
+    })
+})