UNPKG

@sv-use/core

Version:

A collection of Svelte 5 utilities.

25 lines (24 loc) 1.31 kB
type NetworkInformation = { /** The effective bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds. */ readonly downlink: number; /** The maximum downlink speed, in megabits per second (Mbps), for the underlying connection technology. */ readonly downlinkMax: number; /** @see https://developer.mozilla.org/en-US/docs/Glossary/Effective_connection_type */ readonly effectiveType: 'slow-2g' | '2g' | '3g' | '4g'; /** The estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds. */ readonly rtt: number; /** Whether the user has set a reduced data usage option on the user agent or not. */ readonly saveData: boolean; /** The type of connection a device is using to communicate with the network. */ readonly type: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown'; }; type GetNetworkReturn = { readonly isSupported: boolean; readonly current: NetworkInformation; }; /** * Provides information about the connection a device is using to communicate with the network. * @see https://svelte-librarian.github.io/sv-use/docs/core/get-network */ export declare function getNetwork(): GetNetworkReturn; export {};