mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
test new service-worker
This commit is contained in:
parent
107e337e83
commit
83fc86293a
@ -1,3 +1,3 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('scripts/service-worker.js');
|
||||
navigator.serviceWorker.register('scripts/sw2.js');
|
||||
}
|
||||
32
tools/calculator/scripts/sw2.js
Normal file
32
tools/calculator/scripts/sw2.js
Normal file
@ -0,0 +1,32 @@
|
||||
const cacheName = "calcu-v1";
|
||||
const appShellFiles = [
|
||||
"index.html",
|
||||
"styles/dark.css",
|
||||
"styles/light.css",
|
||||
"assets/calculator.ico",
|
||||
"assets/GithubDark.svg",
|
||||
"assets/GithubLight.svg",
|
||||
"assets/MoonIcon.svg",
|
||||
"assets/SunIcon.svg",
|
||||
"scripts/saveOffline.js",
|
||||
"scripts/script.js",
|
||||
"scripts/secret.js",
|
||||
"scripts/service-worker.js",
|
||||
"scripts/sw2.js",
|
||||
"secret/index.html",
|
||||
"secret/script.js",
|
||||
"secret/style.css",
|
||||
];
|
||||
|
||||
|
||||
self.addEventListener("install", (e) => {
|
||||
console.log("[Service Worker] Install");
|
||||
e.waitUntil(
|
||||
(async () => {
|
||||
const cache = await caches.open(cacheName);
|
||||
console.log("[Service Worker] Caching all: app shell and content");
|
||||
await cache.addAll(appShellFiles);
|
||||
})()
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user