fix path
This commit is contained in:
39
www/js/service-worker.js
Normal file
39
www/js/service-worker.js
Normal file
@ -0,0 +1,39 @@
|
||||
const CACHE_NAME = "msv-moos-webcam-app-v1";
|
||||
const URLS_TO_CACHE = [
|
||||
"./",
|
||||
"./index.html",
|
||||
"./css/custom.css",
|
||||
"./css/w3.css",
|
||||
"./js/webcam.js",
|
||||
"./manifest.json",
|
||||
"./data/icon.png",
|
||||
"./data/favicon.ico"
|
||||
];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME).then((cache) => cache.addAll(URLS_TO_CACHE))
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
event.respondWith(
|
||||
caches.match(event.request).then((response) => {
|
||||
return response || fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((cacheNames) =>
|
||||
Promise.all(
|
||||
cacheNames.map((cache) => {
|
||||
if (cache !== CACHE_NAME) {
|
||||
return caches.delete(cache);
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user