2025-12-07 19:32:53 +02:00
|
|
|
import { createWebAPIs } from './api';
|
2026-01-22 01:19:24 +02:00
|
|
|
import { registerSW } from 'virtual:pwa-register';
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
import type { RuntimeAPIs } from '@openchamber/ui/lib/api/types';
|
|
|
|
|
import '@openchamber/ui/index.css';
|
|
|
|
|
import '@openchamber/ui/styles/fonts';
|
|
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface Window {
|
|
|
|
|
__OPENCHAMBER_RUNTIME_APIS__?: RuntimeAPIs;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.__OPENCHAMBER_RUNTIME_APIS__ = createWebAPIs();
|
2026-01-22 01:19:24 +02:00
|
|
|
|
|
|
|
|
registerSW({
|
|
|
|
|
onRegistered(registration: ServiceWorkerRegistration | undefined) {
|
|
|
|
|
if (!registration) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Periodic update check (best-effort)
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
void registration.update();
|
|
|
|
|
}, 60 * 60 * 1000);
|
|
|
|
|
},
|
|
|
|
|
onRegisterError(error: unknown) {
|
|
|
|
|
console.warn('[PWA] service worker registration failed:', error);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
import('@openchamber/ui/main');
|