update the SW some more

This commit is contained in:
MathMan05 committed 2025-12-11 18:15:24 -06:00
1 parent d98ec297f5
commit e71a804bda
1 file changed
+4 -6
+4 -6
View File
@@ -1,8 +1,7 @@
import {messageFrom, messageTo} from "./utils/serviceType";
function deleteoldcache() {
caches.delete("cache");
console.log("this ran :P");
async function deleteoldcache() {
await caches.delete("cache");
}
type files = {[key: string]: string | files};
async function getAllFiles() {
@@ -34,9 +33,7 @@ async function downloadAllFiles() {
}
async function putInCache(request: URL | RequestInfo, response: Response) {
console.log(request, response);
const cache = await caches.open("cache");
console.log("Grabbed");
try {
console.log(await cache.put(request, response));
} catch (error) {
@@ -69,7 +66,8 @@ async function checkCache() {
if (checkedrecently) {
return false;
}
const promise = await caches.match("/getupdates");
const cache = await caches.open("cache");
const promise = await cache.match("/getupdates");
if (promise) {
lastcache = await promise.text();
}