Add event for multiaddresses changed
This commit is contained in:
@@ -153,6 +153,15 @@ export class Libp2pComponent implements ILibp2pComponent {
|
||||
});
|
||||
});
|
||||
|
||||
// Multiaddresses changed event
|
||||
this.eventEmitter.addListener('onMultiaddressesChanged', ({ multiaddrs }: { multiaddrs: string[] }) => {
|
||||
logger.debug('[Libp2pComponent] Multiaddresses changed:', multiaddrs);
|
||||
this._multiaddrs = multiaddrs.map((addr: string) => new SimpleMultiaddr(addr));
|
||||
this.emit('multiaddresses:changed', {
|
||||
multiaddrs: this._multiaddrs,
|
||||
});
|
||||
});
|
||||
|
||||
// Connection events
|
||||
this.eventEmitter.addListener(
|
||||
'onConnectionStatus',
|
||||
|
||||
Reference in New Issue
Block a user