mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-11-10 13:14:24 +08:00
fix: Clear 2.1.0 frontend PWA cache (#6933)
Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
1 parent
6a9f800f58
commit
239ff865bf
2 files changed
+20
-1
No files matched your search
@@ -1,3 +1,20 @@
|
||||
self.addEventListener("install", function (event) {
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
// Clear old caches from vite-plugin-pwa
|
||||
self.addEventListener("activate", function (event) {
|
||||
event.waitUntil(
|
||||
(async function () {
|
||||
const cacheNames = await caches.keys();
|
||||
for (const cacheName of cacheNames) {
|
||||
await caches.delete(cacheName);
|
||||
}
|
||||
await self.clients.claim();
|
||||
})()
|
||||
);
|
||||
});
|
||||
|
||||
// Receive push notifications
|
||||
self.addEventListener("push", function (event) {
|
||||
if (self.Notification?.permission !== "granted") {
|
||||
Reference in new issue
Block a user