271684ce85
Web-App-Manifest, Service Worker und Icons für Install-Prompt; Permissions-Policy erlaubt Mikrofon (self); getUserMedia vor Speech API. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
753 B
JavaScript
30 lines
753 B
JavaScript
const CACHE = 'scoring-v1';
|
|
const ASSETS = [
|
|
'./',
|
|
'./index.html',
|
|
'./manifest.webmanifest',
|
|
'./icons/icon-192.png',
|
|
'./icons/icon-512.png'
|
|
];
|
|
|
|
self.addEventListener('install', (event) => {
|
|
event.waitUntil(
|
|
caches.open(CACHE).then((cache) => cache.addAll(ASSETS)).then(() => self.skipWaiting())
|
|
);
|
|
});
|
|
|
|
self.addEventListener('activate', (event) => {
|
|
event.waitUntil(
|
|
caches.keys()
|
|
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
|
|
.then(() => self.clients.claim())
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', (event) => {
|
|
if (event.request.method !== 'GET') return;
|
|
event.respondWith(
|
|
caches.match(event.request).then((cached) => cached || fetch(event.request))
|
|
);
|
|
});
|