Maybe fix some service worker tomfoolery

This commit is contained in:
Neale Pickett 2021-04-27 19:35:39 -06:00
parent fbc489dfdc
commit c64708fa05
1 changed files with 5 additions and 1 deletions

View File

@ -16,8 +16,12 @@ function install(event) {
self.addEventListener("fetch", e => cacheFetch(e)) self.addEventListener("fetch", e => cacheFetch(e))
function cacheFetch(event) { function cacheFetch(event) {
let fetchInit = {}
if (event.request.match(/(css|js|html)$/)) {
fetchInit.cache = "no-cache"
}
event.respondWith( event.respondWith(
fetch(event.request) fetch(event.request, fetchInit)
.catch(() => { .catch(() => {
return caches.match(event.request) return caches.match(event.request)
}) })