@rogeriodocarmo/offline-detector-web

offline-detector web demo

The app starts online and shows nothing. Use Simulate offline below to see the snackbar, banner and indicator, then change any option and watch it apply. Simulation uses a stub probe, so nothing here contacts the network. Real offline works too: switch the network off in your browser's DevTools.

Simulate

Kind of offline

Only visible in the message when Distinguish the reason is on.

Live state

Status
unknown
Reason
none
Checking
no
isOnline
true

Re-check on return

Re-probing when the user comes back to the tab is opt-in per screen, with useRecheckOnReturn. With brief the pieces show a short “Checking…” while that background probe runs; with none it stays invisible.

How long the stub takes to answer, so Checking is visible.

Options

Text

Say what is wrong instead of plain No internet.

Any string can be overridden; this one changes the Retry button.

Look and motion

How long Back online stays.

Replaces the bundled snackbar with the component in this demo.

Pieces
fullScreen

Swipe, Dismiss button and Escape on the indicator.

Float the banner over the content.

Probe (restarts the detector when changed)

Tried in order; the first success wins. Not contacted while the stub is on.

With interface-only, only the Simulate kind No network connection works.

Off by default. When on, the library contacts the probe URLs above, and Simulate only affects the network interface.

Callbacks

onOffline, onOnline, onChange, onDismiss, onContinueOffline and onError write here, newest first.

Nothing yet.