Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Browser/checkOnlineState

Index

Functions

Functions

checkOnlineState

  • checkOnlineState(pingUrl?: string, stateTtl?: number): Promise<boolean>
  • Checks if the client is currently online or not. This methoed will execute a request to a online resource and does not rely on navigator.isOnline, to reliably if a internet connection can be used.

    Note:

    Parameters

    • Optional pingUrl: string

      The url of an endpoint, you know that is online. If not provided, we use https://ping.labor.tools/ which is a secure, no tracking endpoint that just sends you a "pong" response. It is routed through cloudflare and hosted on github: https://github.com/labor-digital/ping-endpoint

    • Optional stateTtl: number

      A numeric value in milliseconds to define how long a state should be cached. By default the state is cached for 60 seconds.

    Returns Promise<boolean>

Generated using TypeDoc