diff --git a/packages/interface-libp2p/src/index.ts b/packages/interface-libp2p/src/index.ts index be6497198..3e0a606ca 100644 --- a/packages/interface-libp2p/src/index.ts +++ b/packages/interface-libp2p/src/index.ts @@ -108,7 +108,7 @@ export interface IdentifyResult { * Event names are `noun:verb` so the first part is the name of the object * being acted on and the second is the action. */ -export interface Libp2pEvents { +export interface Libp2pEvents { /** * This event is dispatched when a new network peer is discovered. * @@ -225,6 +225,28 @@ export interface Libp2pEvents { * closed. */ 'connection:close': CustomEvent + + /** + * This event notifies listeners that the node has started + * + * ```js + * libp2p.addEventListener('start', (event) => { + * console.info(libp2p.isStarted()) // true + * }) + * ``` + */ + 'start': CustomEvent> + + /** + * This event notifies listeners that the node has stopped + * + * ```js + * libp2p.addEventListener('stop', (event) => { + * console.info(libp2p.isStarted()) // false + * }) + * ``` + */ + 'stop': CustomEvent> } /** @@ -281,7 +303,7 @@ export interface PendingDial { /** * Libp2p nodes implement this interface. */ -export interface Libp2p> extends Startable, EventEmitter { +export interface Libp2p extends Startable, EventEmitter> { /** * The PeerId is a unique identifier for a node on the network. *