This commit is contained in:
slweeb 2023-02-07 19:11:52 -05:00
parent 80c1bbb052
commit f6368d6a34
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
self.addEventListener('fetch', function(event) {
event.respondWith(async function() {
try{
var res = await fetch(event.request);
var cache = await caches.open('cache');
cache.put(event.request.url, res.clone());
return res;
}
catch(error){
return caches.match(event.request);
}
}());
});