📝 Docs: 修复旧 Vuepress 文档缓存问题 (#1077)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
StarHeart 2022-07-02 10:19:51 +08:00 committed by GitHub
parent 1aba737cbd
commit 14b145b58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,14 @@
navigator.serviceWorker.getRegistrations().then(function (e) {
for (
var r, i = e, t = Array.isArray(i), a = 0, i = t ? i : i[Symbol.iterator]();
;
) {
if (t) {
if (a >= i.length) break;
r = i[a++];
} else {
if ((a = i.next()).done) break;
r = a.value;
}
r.unregister();
}
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));
});
});