npm install @solid-primitives/connectivity
yarn add @solid-primitives/connectivity
pnpm add @solid-primitives/connectivity


A navigator.onLine signal that tells you when the browser thinks you're online. Connectivity is determined by your browser, which is a best-effort process.


Attaches event listeners and fires callback whenever window.onLine changes.

import { makeConnectivityListener } from "@solid-primitives/connectivity";

const clear = makeConnectivityListener(isOnline => {
  console.log(isOnline); // T: booelan
// remove event listeners (happens also on cleanup)


function makeConnectivityListener(callback: (isOnline: boolean) => void): VoidFunction;


A signal representing the browser's interpretation of whether it is on- or offline.

import { createConnectivitySignal } from "@solid-primitives/connectivity";

const isOnline = createConnectivitySignal();
isOnline(); // T: boolean


This primitive provides a singleton root variant that will reuse event listeners and signals across dependents.

It's behavior is the same as createConnectivitySignal.

import { useConnectivitySignal } from "@solid-primitives/connectivity";

const isOnline = useConnectivitySignal();
isOnline(); // T: boolean


function createConnectivitySignal(): Accessor<boolean>;


Live Site