Overview
onOnline / onOffline listen for browser connectivity changes on window.
onVisibilityChange uses the Page Visibility API on document. The handler receives true when the tab is hidden and false when visible again — useful for pausing polling or media.
Network & visibility
|
API
|
Signal
|
Notes
|
|---|---|---|
onOnline(fn)
| window online | Browser regained connectivity. |
onOffline(fn)
| window offline | Browser lost connectivity. |
onVisibilityChange(fn)
| document visibilitychange | fn(hidden: boolean) — true when tab is hidden. |
onOnline / onOffline + onVisibilityChange
These hooks wire up window online/offline events and the Page Visibility API. Try switching browser tabs or toggling your network connection to see the event log update.