Feature: add online indicator

This commit is contained in:
Pieter Vander Vennet 2025-08-01 00:40:18 +02:00
parent efeb5ae1d9
commit 76dbf50db1
3 changed files with 44 additions and 0 deletions

19
src/Logic/Web/IsOnline.ts Normal file
View file

@ -0,0 +1,19 @@
import { Store, UIEventSource } from "../UIEventSource"
export class IsOnline {
private static readonly _isOnline: UIEventSource<boolean> = new UIEventSource(navigator.onLine)
static {
window.addEventListener("online", () => {
IsOnline._isOnline.set(true)
})
window.addEventListener("offline", () => {
IsOnline._isOnline.set(false)
})
}
public static readonly isOnline: Store<boolean> = IsOnline._isOnline
}

View file

@ -0,0 +1,4 @@
export class SWGenerated {
// generated by scripts/prepareServiceWorker.ts
static vNumber = "0.54.4"
}