Actually upload the PWA files

This commit is contained in:
2025-11-10 14:54:29 -05:00
parent e9d3b71f28
commit 402b147654
4 changed files with 112 additions and 0 deletions

33
sw.js Normal file
View File

@ -0,0 +1,33 @@
const CACHE_NAME = 'v1';
const ASSETS = [
'/',
'/index.html',
'/script.js',
'/styles.css',
'/manifest.json',
'/icons/192.svg',
'/icons/512.svg',
'/vendor/lucio/graham-scan.mjs'
];
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open(CACHE_NAME).then(cache => cache.addAll(ASSETS))
);
self.skipWaiting();
});
self.addEventListener('activate', (e) => {
e.waitUntil(
caches.keys().then(keys =>
Promise.all(keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)))
)
);
self.clients.claim();
});
self.addEventListener('fetch', (e) => {
e.respondWith(
caches.match(e.request).then(response => response || fetch(e.request))
);
});