feat(pwa): Online-Status-Store
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m31s

Reaktiver Store basierend auf navigator.onLine und den window-
Events online/offline. Kein aktives Heuristik-Probing — für
unseren Offline-PWA-Use-Case reicht der Browser-Status. Wird von
SyncIndicator und require-online-Helper konsumiert.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-18 16:17:11 +02:00
parent 0b12aa027f
commit 04641355df
4 changed files with 571 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
// Reaktiver Online-Status, basierend auf navigator.onLine + events.
// Bewusst kein aktives Heuristik-Probing (Test-Fetches) — für unsere
// Zwecke reicht der Browser-Status.
class NetworkStore {
online = $state(typeof navigator === 'undefined' ? true : navigator.onLine);
init(): void {
if (typeof window === 'undefined') return;
window.addEventListener('online', () => (this.online = true));
window.addEventListener('offline', () => (this.online = false));
}
}
export const network = new NetworkStore();