This build was committed by a bot.

This commit is contained in:
github-actions
2025-08-23 04:27:54 +00:00
parent 0b4c0719c0
commit 449108f1e7

View File

@@ -1,5 +1,5 @@
const V = "1"; const V = "1";
const send = (a) => self.clients.matchAll({ type: "window", includeUncontrolled: true }).then((cs) => cs.forEach((c) => c.postMessage(a))); const send = (m) => self.clients.matchAll({ type: "window", includeUncontrolled: true }).then((cs) => cs.forEach((c) => c.postMessage(m)));
self.addEventListener("install", (e) => { self.addEventListener("install", (e) => {
self.skipWaiting(); self.skipWaiting();
}); });
@@ -9,11 +9,8 @@ self.addEventListener("activate", (e) => {
await send({ type: "SW_ACTIVE", v: V, ts: Date.now() }); await send({ type: "SW_ACTIVE", v: V, ts: Date.now() });
})()); })());
}); });
self.addEventListener("fetch", (e) => {
if (e.request.mode === "navigate") send({ type: "SW_NAVIGATE", url: e.request.url, ts: Date.now() });
});
self.addEventListener("message", (e) => { self.addEventListener("message", (e) => {
if (e.data && e.data.type === "PING") { if (e.data && e.data.type === "PING") {
(e.source || null)?.postMessage({ type: "PONG", v: V, ts: Date.now() }) || send({ type: "PONG", v: V, ts: Date.now() }); (e.source || null)?.postMessage({ type: "PONG", v: V, ts: Date.now() }) || send({ type: "PONG", v: V, ts: Date.now() });
} else send({ type: "SW_MESSAGE", data: e.data, ts: Date.now() }); }
}); });