Refactor code structure for improved readability and maintainability

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Nils-Johan Gynther
2026-04-23 21:14:46 +02:00
parent cd4274575e
commit db1128ceaf
49 changed files with 285993 additions and 175 deletions
@@ -0,0 +1,31 @@
'use strict';
self.addEventListener('install', () => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
(async () => {
try {
await self.registration.unregister();
} catch (e) {
console.warn('Failed to unregister the service worker:', e);
}
try {
const clients = await self.clients.matchAll({
type: 'window',
});
// Reload clients to ensure they are not using the old service worker.
clients.forEach((client) => {
if (client.url && 'navigate' in client) {
client.navigate(client.url);
}
});
} catch (e) {
console.warn('Failed to navigate some service worker clients:', e);
}
})()
);
});