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>
15 lines
530 B
TypeScript
15 lines
530 B
TypeScript
// 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();
|