Files
games-game-minitactix/static/service-worker.js
2025-04-17 20:04:09 +02:00

24 lines
503 B
JavaScript

// /var/www/minitactix/static/service-worker.js
const CACHE_NAME = "minitactix-cache-v1"
const FILES_TO_CACHE = [
"/",
"/index.html",
"/style.css",
"/app.js",
"/manifest.json"
]
self.addEventListener("install", (evt) => {
evt.waitUntil(
caches.open(CACHE_NAME).then((cache) => cache.addAll(FILES_TO_CACHE))
)
self.skipWaiting()
})
self.addEventListener("fetch", (evt) => {
evt.respondWith(
caches.match(evt.request).then((response) => response || fetch(evt.request))
)
})