@waku/core
Version:
TypeScript implementation of the Waku v2 protocol
37 lines (36 loc) • 1.05 kB
TypeScript
import { IWakuEventEmitter, Libp2p } from "@waku/interfaces";
type NetworkMonitorConstructorOptions = {
libp2p: Libp2p;
events: IWakuEventEmitter;
};
interface INetworkMonitor {
start(): void;
stop(): void;
isConnected(): boolean;
isP2PConnected(): boolean;
isBrowserConnected(): boolean;
}
export declare class NetworkMonitor implements INetworkMonitor {
private readonly libp2p;
private readonly events;
private isNetworkConnected;
constructor(options: NetworkMonitorConstructorOptions);
start(): void;
stop(): void;
/**
* Returns true if the node is connected to the network via libp2p and browser.
*/
isConnected(): boolean;
/**
* Returns true if the node is connected to the network via libp2p.
*/
isP2PConnected(): boolean;
/**
* Returns true if the node is connected to the network via browser.
*/
isBrowserConnected(): boolean;
private onConnectedEvent;
private onDisconnectedEvent;
private dispatchNetworkEvent;
}
export {};