Spaces:
Running
Running
Download sw.js from CyberMax-tools/sumbloom: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/CyberMax-tools/sumbloom/resolve/96a4f6b282f85a53d741a4da427332e22084cbfe/sw.js
- Command line
-
hf download hf://spaces/CyberMax-tools/sumbloom@96a4f6b282f85a53d741a4da427332e22084cbfe/sw.js
-
curl -L -o sw.js https://huggingface.co/spaces/CyberMax-tools/sumbloom/resolve/96a4f6b282f85a53d741a4da427332e22084cbfe/sw.js
1.17 kB
| /* Sumbloom offline cache. © 2026 CyberMax. All rights reserved. */ | |
| var CACHE = "sumbloom-v1"; | |
| var FILES = ["./", "index.html", "style.css", "puzzle.js", "game.js", "manifest.webmanifest", "icon.svg", "icon-192.png", "icon-512.png"]; | |
| self.addEventListener("install", function (e) { | |
| e.waitUntil(caches.open(CACHE).then(function (c) { return c.addAll(FILES); }).then(function () { return self.skipWaiting(); })); | |
| }); | |
| self.addEventListener("activate", function (e) { | |
| e.waitUntil(caches.keys().then(function (keys) { | |
| return Promise.all(keys.filter(function (k) { return k !== CACHE; }).map(function (k) { return caches.delete(k); })); | |
| }).then(function () { return self.clients.claim(); })); | |
| }); | |
| self.addEventListener("fetch", function (e) { | |
| if (e.request.method !== "GET" || new URL(e.request.url).origin !== location.origin) return; | |
| // Network first so updates arrive quickly; cache as offline fallback. | |
| e.respondWith(fetch(e.request).then(function (r) { | |
| var copy = r.clone(); | |
| caches.open(CACHE).then(function (c) { c.put(e.request, copy); }); | |
| return r; | |
| }).catch(function () { return caches.match(e.request, { ignoreSearch: true }); })); | |
| }); | |