BrowserConnectivityChecker

Real reachability on wasmJs, read straight from navigator.onLine.

Before this, wasmJs fell through to AlwaysOnlineConnectivityChecker, which returns true without checking anything. That is the dishonest case the rest of this module avoids: a caller gating a sync on isOnline was told "yes" on a machine with no network at all, then failed at the HTTP call with a worse error than it needed.

No dependency was added for this, deliberately. dev.jordond.connectivity's device artifact publishes no wasm target, and reaching window the usual way would mean pulling in kotlinx-browser — a whole DOM library for one boolean, on a target that today is only a preview. One @JsFun is the smaller answer.

canObserveConnectivity stays false and observeIsOnline keeps the single-shot default. The browser does fire online/offline events, but subscribing to them from Kotlin/Wasm needs the DOM library this class exists to avoid. Reporting false is the honest position: offline-outbox then keeps its timer retry here rather than subscribing to a Flow that never emits again.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Whether observeIsOnline is a real push observer or the single-shot default above.

Link copied to clipboard
open override fun isOnline(): Boolean
Link copied to clipboard

Live connectivity observer. Default is a single-shot Flow of the current isOnline value (no push updates) — override for a real observer. KonnectionConnectivityChecker does.