Companion-App: zur deploybaren PWA ausgebaut (statisch)
- 04_Tablet-Quiz/prototype -> app/ (deploybarer Stand). - PWA: manifest.webmanifest + sw.js (Offline-App-Shell) + icon.svg, im <head> eingebunden, Service-Worker-Registrierung. - Debrief-Export als Datei-Download (Markdown UND JSON) ergaenzt. - DEPLOY.md: Anleitung fuer statisches Hosting (nginx/Caddy, HTTPS, Verifikation). - README: Umsetzungsstand + MVP-Haken aktualisiert. - .claude/launch.json (lokale Preview), settings.local.json ge-gitignored. Verifiziert: 40 Stationen / 3 Gates / 45 Quizfragen, JS+SW-Syntax + Manifest valide, alle Assets via http 200. (Inhalte noch in index.html eingebettet; YAML-Pipeline = naechster Schritt.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ab61222cf2
commit
7f0e847561
8 changed files with 196 additions and 9 deletions
33
04_Tablet-Quiz/app/sw.js
Normal file
33
04_Tablet-Quiz/app/sw.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* Service Worker — SLC-Workshop Companion (App-Shell, offline-first) */
|
||||
const CACHE = "slc-companion-v1";
|
||||
const ASSETS = ["./", "index.html", "manifest.webmanifest", "icon.svg"];
|
||||
|
||||
self.addEventListener("install", (e) => {
|
||||
e.waitUntil(
|
||||
caches.open(CACHE).then((c) => c.addAll(ASSETS)).then(() => self.skipWaiting())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (e) => {
|
||||
e.waitUntil(
|
||||
caches.keys()
|
||||
.then((ks) => Promise.all(ks.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
|
||||
.then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (e) => {
|
||||
if (e.request.method !== "GET") return;
|
||||
e.respondWith(
|
||||
caches.match(e.request).then((hit) =>
|
||||
hit ||
|
||||
fetch(e.request)
|
||||
.then((resp) => {
|
||||
const copy = resp.clone();
|
||||
caches.open(CACHE).then((c) => c.put(e.request, copy));
|
||||
return resp;
|
||||
})
|
||||
.catch(() => caches.match("index.html"))
|
||||
)
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue