Skip to content

onOnline

The onOnline function adds a listener for the browser's online event.

Syntax

typescript
onOnline(listener: () => void): void;

Parameters

NameTypeDescription
listener() => voidFunction called when coming back online

Returns

NameTypeDescription
voidDoes not return a value

Examples

typescript
onOnline(() => {
  alert("You are back online!");
});

Notes

  • Useful for detecting reconnection and adapting the interface.

References

Released under the MIT License.