chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-07-21 10:52:51 +02:00
parent 14b2799f08
commit 4add2d1aff
151 changed files with 4561 additions and 3315 deletions

View file

@ -23,7 +23,7 @@ async function activate() {
.catch(console.error)
}
function fetchAndCache(event){
function fetchAndCache(event) {
return fetch(event.request).then((networkResponse) => {
return caches.open(version).then((cache) => {
cache.put(event.request, networkResponse.clone())
@ -38,7 +38,7 @@ const cacheFirst = async (event, attemptUpdate: boolean = false) => {
caches.match(event.request, { ignoreSearch: true }).then((cacheResponse) => {
if (cacheResponse !== undefined) {
console.debug("Loaded from cache: ", event.request)
if(attemptUpdate){
if (attemptUpdate) {
fetchAndCache(event)
}
return cacheResponse