egui-circles/assets/sw.js
djmil cdb3f26532 wasm32 build target (#10)
This PR closes #5

- code refactors for the `wasm32`
- docker container for `wasm32`

Reviewed-on: #10
2024-08-31 12:23:28 +02:00

26 lines
589 B
JavaScript

var cacheName = 'egui_circles';
var filesToCache = [
'./',
'./index.html',
'./egui_circles.js',
'./egui_circles_bg.wasm',
];
/* 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);
})
);
});