smodusermc/offline-games / site /games /coffee /ServiceWorker.js
smodusermc's picture
download
raw
1.08 kB
const cacheName = "EDUrocks Group-CoffeeTalk (WP)-1.01";
const contentToCache = [
"Build/web-pub.loader.js",
"Build/web-pub.framework.js.unityweb",
"Build/web-pub.data.unityweb",
"Build/web-pub.wasm.unityweb",
"TemplateData/style.css"
];
self.addEventListener('install', function (e) {
console.log('[Service Worker] Install');
e.waitUntil((async function () {
const cache = await caches.open(cacheName);
console.log('[Service Worker] Caching all: app shell and content');
await cache.addAll(contentToCache);
})());
});
self.addEventListener('fetch', function (e) {
e.respondWith((async function () {
let response = await caches.match(e.request);
console.log(`[Service Worker] Fetching resource: ${e.request.url}`);
if (response) { return response; }
response = await fetch(e.request);
const cache = await caches.open(cacheName);
console.log(`[Service Worker] Caching new resource: ${e.request.url}`);
cache.put(e.request, response.clone());
return response;
})());
});

Xet Storage Details

Size:
1.08 kB
·
Xet hash:
1faa751f2b5ef5563edc1cb0c07fade9e24edf78e0540dd5c8c98ed9c373a757

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.