22 lines
714 B
JavaScript
22 lines
714 B
JavaScript
const CACHE_NAME = 'eng-game-v2';
|
|
const ASSETS = [
|
|
'./',
|
|
'./index.html',
|
|
'./data.js',
|
|
'./manifest.json',
|
|
'https://cdn.tailwindcss.com',
|
|
'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,1,0',
|
|
'https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Comic+Neue:wght@400;700&family=Inter:wght@300;400;600;800&display=swap'
|
|
];
|
|
|
|
self.addEventListener('install', (e) => {
|
|
e.waitUntil(
|
|
caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS))
|
|
);
|
|
});
|
|
|
|
self.addEventListener('fetch', (e) => {
|
|
e.respondWith(
|
|
caches.match(e.request).then((response) => response || fetch(e.request))
|
|
);
|
|
}); |