@decafhub/decaf-react - v0.8.1
    Preparing search index...

    Function useConnectionStatus

    • Probes a URL on an interval and reports a three-state connection status.

      Detection rules:

      • A probe that resolves within slowThreshold ms → resets all counters, status online.
      • A probe that resolves but exceeded slowThreshold, or aborted at hardTimeout → counts as slow. Status flips to slow only after slowAfter consecutive slow probes.
      • A probe rejected with a real network error (not an abort) → counts as a network failure. Status flips to offline only after offlineAfter consecutive network failures.
      • navigator.onLine === false (or the offline window event) is trusted as an immediate offline signal; the online event clears it back to online.
      • Polling pauses while the tab is hidden to avoid accumulating failures from a throttled tab.

      Parameters

      Returns ConnectionStatus