connection-state
Version:
Detect online and offline network state.
12 lines (11 loc) • 502 B
TypeScript
export type ConnectionState = 'online' | 'offline';
export type ConnectionOptions = {
endpoints?: string[];
initialState?: ConnectionState;
retryInterval?: number;
};
export declare const connectionState: (options?: ConnectionOptions) => {
addListener: (callback: (data: ConnectionState) => void, options?: import("custom-listenable").ListenerOptions | undefined) => void;
removeListener: (callback: (data: ConnectionState) => void) => void;
getState: () => ConnectionState;
};