Initial commit

This commit is contained in:
cpu
2025-03-22 22:31:00 +01:00
parent 2bebd8cc88
commit a480ecaf65
2 changed files with 14 additions and 5 deletions

View File

@@ -1,13 +1,13 @@
{ {
"name": "Game Timer PWA", "name": "Game Timer",
"short_name": "Game Timer", "short_name": "Timer",
"description": "Multi-player chess-like timer with carousel navigation", "description": "Multi-player chess-like timer with carousel navigation",
"start_url": "/index.html", "start_url": "/",
"id": "/index.html", "id": "/index.html",
"display": "standalone", "display": "standalone",
"display_override": ["window-controls-overlay", "standalone", "minimal-ui"], "display_override": ["window-controls-overlay", "standalone", "minimal-ui"],
"background_color": "#f5f5f5", "background_color": "#ffffff",
"theme_color": "#2c3e50", "theme_color": "#000000",
"icons": [ "icons": [
{ {
"src": "/icons/android-chrome-192x192.png", "src": "/icons/android-chrome-192x192.png",

9
sw.js
View File

@@ -70,6 +70,15 @@ self.addEventListener('activate', event => {
); );
}); });
self.addEventListener('fetch', (event) => {
console.log('[ServiceWorker] Fetch');
event.respondWith(
caches.match(event.request).then((cachedResponse) => {
return cachedResponse || fetch(event.request);
})
);
});
// Helper function to determine if a response should be cached // Helper function to determine if a response should be cached
function shouldCacheResponse(request, response) { function shouldCacheResponse(request, response) {
// Only cache GET requests // Only cache GET requests