egui-circles/assets/sw.js

26 lines
589 B
JavaScript
Raw Normal View History

2024-08-30 20:15:52 +02:00
var cacheName = 'egui_circles';
2024-07-03 22:22:53 +02:00
var filesToCache = [
'./',
'./index.html',
2024-08-30 20:15:52 +02:00
'./egui_circles.js',
'./egui_circles_bg.wasm',
2024-07-03 22:22:53 +02:00
];
/* Start the service worker and cache all of the app's content */
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open(cacheName).then(function (cache) {
return cache.addAll(filesToCache);
})
);
});
/* Serve cached content when offline */
self.addEventListener('fetch', function (e) {
e.respondWith(
caches.match(e.request).then(function (response) {
return response || fetch(e.request);
})
);
});