Deletes old project

This commit is contained in:
Rune Harlyk
2024-04-25 21:57:34 +02:00
committed by Rune Harlyk
parent 0b4fe8a0ef
commit 027d5eebc7
189 changed files with 1341 additions and 7239 deletions
+45
View File
@@ -0,0 +1,45 @@
const CACHE_NAME = 'v1';
const urlsToCache = ['/', '/index.html', '/stl.zip'];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(urlsToCache);
})
);
});
// self.addEventListener('fetch', (event) => {
// event.respondWith(
// caches.match(event.request).then((response) => {
// if (response) {
// return response;
// }
// return fetch(event.request).then((response) => {
// if (!response || response.status !== 200 || response.type !== 'basic') {
// return response;
// }
// var responseToCache = response.clone();
// caches.open(CACHE_NAME).then((cache) => {
// cache.put(event.request, responseToCache);
// });
// return response;
// });
// })
// );
// });
self.addEventListener('activate', (event) => {
var cacheWhitelist = ['v1'];
event.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(
cacheNames.map((cacheName) => {
if (cacheWhitelist.indexOf(cacheName) === -1) {
return caches.delete(cacheName);
}
})
);
})
);
});