A readable store to easily access the current state of the network. The Network Information API provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.). This can be used to select high definition content or low definition content based on the user's connection. The entire API consists of the addition of the NetworkInformation interface and a single property to the Navigator interface: Navigator.connection.


Try toggling your network connectivity using Network in Devtools.

  "isSupported": false,
  "isOnline": true,
  "saveData": false,
  "type": "unknown"


<script lang="ts">
import { networkStore } from 'svelte-legos';

const networkState = networkStore();

// $networkState has these properties

// isSupported: boolean
// isOnline: boolean
// offlineAt: number | undefined
// onlineAt: number | undefined
// downlink: number | undefined
// downlinkMax: number | undefined
// effectiveType: NetworkEffectiveType | undefined
// rtt: number | undefined
// saveData: boolean | undefined
// type: NetworkType