Update 2025-04-17_20:04:08
This commit is contained in:
23
static/service-worker.js
Normal file
23
static/service-worker.js
Normal file
@ -0,0 +1,23 @@
|
||||
// /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))
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user