mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-04-25 13:42:15 +00:00
Gossipsub to extends EventEmitter interface
This commit is contained in:
parent
38ff42c46b
commit
9bcdef4ac7
15
types/libp2p-gossipsub/index.d.ts
vendored
15
types/libp2p-gossipsub/index.d.ts
vendored
@ -24,12 +24,21 @@ declare module 'libp2p-gossipsub' {
|
|||||||
fallbackToFloodsub?: boolean,
|
fallbackToFloodsub?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class GossipSub {
|
import * as Events from "events";
|
||||||
|
|
||||||
|
interface GossipSub extends Events.EventEmitter {}
|
||||||
|
|
||||||
|
class GossipSub {
|
||||||
constructor(peerInfo: PeerInfo, registrar: Registrar, options: Options);
|
constructor(peerInfo: PeerInfo, registrar: Registrar, options: Options);
|
||||||
|
publish(topic: string, data: Buffer): Promise<void>;
|
||||||
|
start(): Promise<void>;
|
||||||
|
stop(): Promise<void>;
|
||||||
|
subscribe(topic: string): void;
|
||||||
|
unsubscribe(topic: string): void;
|
||||||
validate(message: IGossipMessage): Promise<boolean>;
|
validate(message: IGossipMessage): Promise<boolean>;
|
||||||
_emitMessage(topics: string[], message: IGossipMessage): void;
|
_emitMessage(topics: string[], message: IGossipMessage): void;
|
||||||
getTopics(): string[];
|
getTopics(): string[];
|
||||||
// EventEmitter
|
|
||||||
emit(event: string | symbol, ...args: any[]): boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default GossipSub;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user