2021-08-20 09:25:06 +02:00
<!doctype html>
< html class = "default no-js" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
2021-09-24 10:32:37 +02:00
< title > Libp2p | libp2p - v0.33.0< / title >
< meta name = "description" content = "Documentation for libp2p - v0.33.0" >
2021-08-20 09:25:06 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< link rel = "stylesheet" href = "../assets/css/main.css" >
< script async src = "../assets/js/search.js" id = "search-script" > < / script >
< / head >
< body >
< header >
< div class = "tsd-page-toolbar" >
< div class = "container" >
< div class = "table-wrap" >
< div class = "table-cell" id = "tsd-search" data-index = "../assets/js/search.json" data-base = ".." >
< div class = "field" >
< label for = "tsd-search-field" class = "tsd-widget search no-caption" > Search< / label >
< input id = "tsd-search-field" type = "text" / >
< / div >
< ul class = "results" >
< li class = "state loading" > Preparing search index...< / li >
< li class = "state failure" > The search index is not available< / li >
< / ul >
2021-09-24 10:32:37 +02:00
< a href = "../index.html" class = "title" > libp2p - v0.33.0< / a >
2021-08-20 09:25:06 +02:00
< / div >
< div class = "table-cell" id = "tsd-widgets" >
< div id = "tsd-filter" >
< a href = "#" class = "tsd-widget options no-caption" data-toggle = "options" > Options< / a >
< div class = "tsd-filter-group" >
< div class = "tsd-select" id = "tsd-filter-visibility" >
< span class = "tsd-select-label" > All< / span >
< ul class = "tsd-select-list" >
< li data-value = "public" > Public< / li >
< li data-value = "protected" > Public/Protected< / li >
< li data-value = "private" class = "selected" > All< / li >
< / ul >
< / div >
< input type = "checkbox" id = "tsd-filter-inherited" checked / >
< label class = "tsd-widget" for = "tsd-filter-inherited" > Inherited< / label >
< input type = "checkbox" id = "tsd-filter-externals" checked / >
< label class = "tsd-widget" for = "tsd-filter-externals" > Externals< / label >
< / div >
< / div >
< a href = "#" class = "tsd-widget menu no-caption" data-toggle = "menu" > Menu< / a >
< / div >
< / div >
< / div >
< / div >
< div class = "tsd-page-title" >
< div class = "container" >
< ul class = "tsd-breadcrumb" >
< li >
2021-09-24 10:32:37 +02:00
< a href = "../modules.html" > libp2p - v0.33.0< / a >
2021-08-20 09:25:06 +02:00
< / li >
< li >
< a href = "libp2p.html" > Libp2p< / a >
< / li >
< / ul >
< h1 > Class Libp2p< / h1 >
< / div >
< / div >
< / header >
< div class = "container container-main" >
< div class = "row" >
< div class = "col-8 col-content" >
< section class = "tsd-panel tsd-comment" >
< div class = "tsd-comment tsd-typography" >
< dl class = "tsd-comment-tags" >
< dt > property< / dt >
< dd > < p > {Connection} connection< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {MuxedStream} stream< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {string} protocol< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} [enabled = false]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {number} [queriesPerPeriod = 1]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {number} [interval = 300e3]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {number} [timeout = 10e3]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} [enabled = false]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {number} [kBucketSize = 20]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {RandomWalkOptions} [randomWalk]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} [clientMode]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' libp2p-interfaces/src/types' ).DhtSelectors} [selectors]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' libp2p-interfaces/src/types' ).DhtValidators} [validators]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Datastore} [datastore]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} persistence< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} enabled< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} enabled< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {boolean} [enabled = true]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./circuit' ).RelayAdvertiseOptions} [advertise]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./circuit' ).HopOptions} [hop]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./circuit' ).AutoRelayOptions} [autoRelay]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {DhtOptions} [dht] dht module options< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./nat-manager' ).NatManagerOptions} [nat]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Record< string, Object|boolean> } [peerDiscovery]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PubsubLocalOptions & PubsubOptions} [pubsub] pubsub module options< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {RelayOptions} [relay]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Record< string, Object> } [transport] transport options indexed by transport key< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {TransportFactory[]} transport< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {MuxerFactory[]} streamMuxer< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Crypto[]} connEncryption< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PeerDiscoveryFactory[]} [peerDiscovery]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PeerRoutingModule[]} [peerRouting]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {ContentRoutingModule[]} [contentRouting]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Object} [dht]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {{new(...args: any[]): Pubsub}} [pubsub]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Protector} [connProtector]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Libp2pModules} modules libp2p modules to use< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./address-manager' ).AddressManagerOptions} [addresses]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./connection-manager' ).ConnectionManagerOptions} [connectionManager]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Datastore} [datastore]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./dialer' ).DialerOptions} [dialer]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./identify/index' ).HostProperties} [host] libp2p host< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {KeychainOptions & import(' ./keychain/index' ).KeychainOptions} [keychain]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {MetricsOptions & import(' ./metrics' ).MetricsOptions} [metrics]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./peer-routing' ).PeerRoutingOptions} [peerRouting]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PeerStoreOptions & import(' ./peer-store/persistent' ).PersistentPeerStoreOptions} [peerStore]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {import(' ./transport-manager' ).TransportManagerOptions} [transportManager]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {Libp2pConfig} [config]< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PeerId} peerId< / p >
< / dd >
< dt > property< / dt >
< dd > < p > {PeerId} [peerId]< / p >
< / dd >
< dt > fires< / dt >
< dd > < p > Libp2p#error Emitted when an error occurs< / p >
< / dd >
< dt > fires< / dt >
< dd > < p > Libp2p#peer:discovery Emitted when a peer is discovered< / p >
< / dd >
< / dl >
< / div >
< / section >
< section class = "tsd-panel tsd-hierarchy" >
< h3 > Hierarchy< / h3 >
< ul class = "tsd-hierarchy" >
< li >
< span class = "tsd-signature-type" > EventEmitter< / span >
< ul class = "tsd-hierarchy" >
< li >
< span class = "target" > Libp2p< / span >
< / li >
< / ul >
< / li >
< / ul >
< / section >
< section class = "tsd-panel-group tsd-index-group" >
< h2 > Index< / h2 >
< section class = "tsd-panel tsd-index-panel" >
< div class = "tsd-index-content" >
< section class = "tsd-index-section " >
< h3 > Constructors< / h3 >
< ul class = "tsd-index-list" >
< li class = "tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite" > < a href = "libp2p.html#constructor" class = "tsd-kind-icon" > constructor< / a > < / li >
< / ul >
< / section >
< section class = "tsd-index-section " >
< h3 > Properties< / h3 >
< ul class = "tsd-index-list" >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_config" class = "tsd-kind-icon" > _config< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_dht" class = "tsd-kind-icon" > _dht< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_discovery" class = "tsd-kind-icon" > _discovery< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_isstarted" class = "tsd-kind-icon" > _is< wbr > Started< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_modules" class = "tsd-kind-icon" > _modules< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_options" class = "tsd-kind-icon" > _options< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#_transport" class = "tsd-kind-icon" > _transport< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#addressmanager" class = "tsd-kind-icon" > address< wbr > Manager< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#addresses" class = "tsd-kind-icon" > addresses< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#connectionmanager" class = "tsd-kind-icon" > connection< wbr > Manager< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#contentrouting" class = "tsd-kind-icon" > content< wbr > Routing< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#datastore" class = "tsd-kind-icon" > datastore< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#dialer" class = "tsd-kind-icon" > dialer< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#identifyservice" class = "tsd-kind-icon" > identify< wbr > Service< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#keychain" class = "tsd-kind-icon" > keychain< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#metrics" class = "tsd-kind-icon" > metrics< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#natmanager" class = "tsd-kind-icon" > nat< wbr > Manager< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#peerid" class = "tsd-kind-icon" > peer< wbr > Id< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#peerrouting" class = "tsd-kind-icon" > peer< wbr > Routing< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#peerstore" class = "tsd-kind-icon" > peer< wbr > Store< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#pubsub" class = "tsd-kind-icon" > pubsub< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#registrar" class = "tsd-kind-icon" > registrar< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#relay" class = "tsd-kind-icon" > relay< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#transportmanager" class = "tsd-kind-icon" > transport< wbr > Manager< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < a href = "libp2p.html#upgrader" class = "tsd-kind-icon" > upgrader< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#capturerejectionsymbol" class = "tsd-kind-icon" > capture< wbr > Rejection< wbr > Symbol< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#capturerejections" class = "tsd-kind-icon" > capture< wbr > Rejections< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#defaultmaxlisteners" class = "tsd-kind-icon" > default< wbr > Max< wbr > Listeners< / a > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#errormonitor" class = "tsd-kind-icon" > error< wbr > Monitor< / a > < / li >
< / ul >
< / section >
< section class = "tsd-index-section " >
< h3 > Accessors< / h3 >
< ul class = "tsd-index-list" >
< li class = "tsd-kind-get-signature tsd-parent-kind-class" > < a href = "libp2p.html#connections" class = "tsd-kind-icon" > connections< / a > < / li >
< li class = "tsd-kind-get-signature tsd-parent-kind-class" > < a href = "libp2p.html#multiaddrs" class = "tsd-kind-icon" > multiaddrs< / a > < / li >
< / ul >
< / section >
< section class = "tsd-index-section " >
< h3 > Methods< / h3 >
< ul class = "tsd-index-list" >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#_dial" class = "tsd-kind-icon" > _dial< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-private" > < a href = "libp2p.html#_maybeconnect" class = "tsd-kind-icon" > _maybe< wbr > Connect< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-private" > < a href = "libp2p.html#_ondidstart" class = "tsd-kind-icon" > _on< wbr > Did< wbr > Start< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-private" > < a href = "libp2p.html#_ondiscoverypeer" class = "tsd-kind-icon" > _on< wbr > Discovery< wbr > Peer< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#_onstarting" class = "tsd-kind-icon" > _on< wbr > Starting< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-private" > < a href = "libp2p.html#_setuppeerdiscovery" class = "tsd-kind-icon" > _setup< wbr > Peer< wbr > Discovery< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#addlistener" class = "tsd-kind-icon" > add< wbr > Listener< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#dial" class = "tsd-kind-icon" > dial< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#dialprotocol" class = "tsd-kind-icon" > dial< wbr > Protocol< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-overwrite" > < a href = "libp2p.html#emit" class = "tsd-kind-icon" > emit< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#eventnames" class = "tsd-kind-icon" > event< wbr > Names< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#getmaxlisteners" class = "tsd-kind-icon" > get< wbr > Max< wbr > Listeners< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#handle" class = "tsd-kind-icon" > handle< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#hangup" class = "tsd-kind-icon" > hang< wbr > Up< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#isstarted" class = "tsd-kind-icon" > is< wbr > Started< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#listenercount" class = "tsd-kind-icon" > listener< wbr > Count< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#listeners" class = "tsd-kind-icon" > listeners< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#loadkeychain" class = "tsd-kind-icon" > load< wbr > Keychain< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#off" class = "tsd-kind-icon" > off< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#on" class = "tsd-kind-icon" > on< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#once" class = "tsd-kind-icon" > once< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#ping" class = "tsd-kind-icon" > ping< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#prependlistener" class = "tsd-kind-icon" > prepend< wbr > Listener< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#prependoncelistener" class = "tsd-kind-icon" > prepend< wbr > Once< wbr > Listener< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#rawlisteners" class = "tsd-kind-icon" > raw< wbr > Listeners< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#removealllisteners" class = "tsd-kind-icon" > remove< wbr > All< wbr > Listeners< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#removelistener" class = "tsd-kind-icon" > remove< wbr > Listener< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" > < a href = "libp2p.html#setmaxlisteners" class = "tsd-kind-icon" > set< wbr > Max< wbr > Listeners< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#start" class = "tsd-kind-icon" > start< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#stop" class = "tsd-kind-icon" > stop< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < a href = "libp2p.html#unhandle" class = "tsd-kind-icon" > unhandle< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-static" > < a href = "libp2p.html#create" class = "tsd-kind-icon" > create< / a > < / li >
2021-09-03 10:05:01 +02:00
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#geteventlisteners" class = "tsd-kind-icon" > get< wbr > Event< wbr > Listeners< / a > < / li >
2021-08-20 09:25:06 +02:00
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#listenercount-1" class = "tsd-kind-icon" > listener< wbr > Count< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#on-1" class = "tsd-kind-icon" > on< / a > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" > < a href = "libp2p.html#once-1" class = "tsd-kind-icon" > once< / a > < / li >
< / ul >
< / section >
< / div >
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Constructors< / h2 >
< section class = "tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite" >
< a name = "constructor" class = "tsd-anchor" > < / a >
< h3 > constructor< / h3 >
< ul class = "tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite" >
< li class = "tsd-signature tsd-kind-icon" > new < wbr > Libp2p< span class = "tsd-signature-symbol" > (< / span > _options< span class = "tsd-signature-symbol" > : < / span > < a href = "../interfaces/libp2poptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > Libp2pOptions< / a > < span class = "tsd-signature-symbol" > & < / span > < a href = "../interfaces/constructoroptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > constructorOptions< / a > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Libp2p< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Overrides EventEmitter.constructor< / p >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L152" > src/index.js:152< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Libp2p node.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > _options: < a href = "../interfaces/libp2poptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > Libp2pOptions< / a > < span class = "tsd-signature-symbol" > & < / span > < a href = "../interfaces/constructoroptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > constructorOptions< / a > < / h5 >
< div class = "tsd-comment tsd-typography" >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Libp2p< / span > < / h4 >
< / li >
< / ul >
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Properties< / h2 >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_config" class = "tsd-anchor" > < / a >
< h3 > _config< / h3 >
2021-09-21 09:46:53 +02:00
< div class = "tsd-signature tsd-kind-icon" > _config< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-symbol" > { < / span > dht< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > kBucketSize< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > randomWalk< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > interval< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > queriesPerPeriod< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > timeout< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > nat< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > externalIp< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > null< / span > < span class = "tsd-signature-symbol" > ; < / span > gateway< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > null< / span > < span class = "tsd-signature-symbol" > ; < / span > keepAlive< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > pmp< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > ttl< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > peerDiscovery< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > autoDial< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > protocolPrefix< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > ; < / span > pubsub< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > relay< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > advertise< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > bootDelay< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > ttl< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > autoRelay< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > maxListeners< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type"
2021-08-20 09:25:06 +02:00
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_dht" class = "tsd-anchor" > < / a >
< h3 > _dht< / h3 >
< div class = "tsd-signature tsd-kind-icon" > _dht< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > any< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_discovery" class = "tsd-anchor" > < / a >
< h3 > _discovery< / h3 >
< div class = "tsd-signature tsd-kind-icon" > _discovery< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > Map< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > , < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > > < / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_isstarted" class = "tsd-anchor" > < / a >
< h3 > _is< wbr > Started< / h3 >
< div class = "tsd-signature tsd-kind-icon" > _is< wbr > Started< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > boolean< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_modules" class = "tsd-anchor" > < / a >
< h3 > _modules< / h3 >
< div class = "tsd-signature tsd-kind-icon" > _modules< span class = "tsd-signature-symbol" > :< / span > < a href = "../interfaces/libp2pmodules.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > Libp2pModules< / a > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_options" class = "tsd-anchor" > < / a >
< h3 > _options< / h3 >
2021-09-21 09:46:53 +02:00
< div class = "tsd-signature tsd-kind-icon" > _options< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-symbol" > { < / span > addresses< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > announce< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > announceFilter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > multiaddrs< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > listen< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > noAnnounce< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > config< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > dht< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > kBucketSize< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > randomWalk< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > interval< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > queriesPerPeriod< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > ; < / span > timeout< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > nat< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > externalIp< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > null< / span > < span class = "tsd-signature-symbol" > ; < / span > gateway< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > null< / span > < span class = "tsd-signature-symbol" > ; < / span > keepAlive< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > ; < / span > pmp< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > enabled< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > ttl< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > peerDiscovery< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > autoDial< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > ; < / span > protocolPrefix< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > ; < /
2021-08-20 09:25:06 +02:00
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "_transport" class = "tsd-anchor" > < / a >
< h3 > _transport< / h3 >
< div class = "tsd-signature tsd-kind-icon" > _transport< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "addressmanager" class = "tsd-anchor" > < / a >
< h3 > address< wbr > Manager< / h3 >
< div class = "tsd-signature tsd-kind-icon" > address< wbr > Manager< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > AddressManager< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "addresses" class = "tsd-anchor" > < / a >
< h3 > addresses< / h3 >
< div class = "tsd-signature tsd-kind-icon" > addresses< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-symbol" > { < / span > announce< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > announceFilter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > multiaddrs< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > listen< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > noAnnounce< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > never< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > & < / span > < span class = "tsd-signature-type" > AddressManagerOptions< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "connectionmanager" class = "tsd-anchor" > < / a >
< h3 > connection< wbr > Manager< / h3 >
< div class = "tsd-signature tsd-kind-icon" > connection< wbr > Manager< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > ConnectionManager< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "contentrouting" class = "tsd-anchor" > < / a >
< h3 > content< wbr > Routing< / h3 >
< div class = "tsd-signature tsd-kind-icon" > content< wbr > Routing< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > ContentRouting< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "datastore" class = "tsd-anchor" > < / a >
< h3 > datastore< / h3 >
< div class = "tsd-signature tsd-kind-icon" > datastore< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Datastore< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "dialer" class = "tsd-anchor" > < / a >
< h3 > dialer< / h3 >
< div class = "tsd-signature tsd-kind-icon" > dialer< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > Dialer< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "identifyservice" class = "tsd-anchor" > < / a >
< h3 > identify< wbr > Service< / h3 >
< div class = "tsd-signature tsd-kind-icon" > identify< wbr > Service< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > IdentifyService< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "keychain" class = "tsd-anchor" > < / a >
< h3 > keychain< / h3 >
< div class = "tsd-signature tsd-kind-icon" > keychain< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Keychain< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "metrics" class = "tsd-anchor" > < / a >
< h3 > metrics< / h3 >
< div class = "tsd-signature tsd-kind-icon" > metrics< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Metrics< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "natmanager" class = "tsd-anchor" > < / a >
< h3 > nat< wbr > Manager< / h3 >
< div class = "tsd-signature tsd-kind-icon" > nat< wbr > Manager< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > NatManager< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "peerid" class = "tsd-anchor" > < / a >
< h3 > peer< wbr > Id< / h3 >
< div class = "tsd-signature tsd-kind-icon" > peer< wbr > Id< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > PeerId< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "peerrouting" class = "tsd-anchor" > < / a >
< h3 > peer< wbr > Routing< / h3 >
< div class = "tsd-signature tsd-kind-icon" > peer< wbr > Routing< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > PeerRouting< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "peerstore" class = "tsd-anchor" > < / a >
< h3 > peer< wbr > Store< / h3 >
< div class = "tsd-signature tsd-kind-icon" > peer< wbr > Store< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > PeerStore< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "pubsub" class = "tsd-anchor" > < / a >
< h3 > pubsub< / h3 >
< div class = "tsd-signature tsd-kind-icon" > pubsub< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > PubsubBaseProtocol< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "registrar" class = "tsd-anchor" > < / a >
< h3 > registrar< / h3 >
< div class = "tsd-signature tsd-kind-icon" > registrar< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > Registrar< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "relay" class = "tsd-anchor" > < / a >
< h3 > relay< / h3 >
< div class = "tsd-signature tsd-kind-icon" > relay< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Relay< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "transportmanager" class = "tsd-anchor" > < / a >
< h3 > transport< wbr > Manager< / h3 >
< div class = "tsd-signature tsd-kind-icon" > transport< wbr > Manager< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > TransportManager< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class" >
< a name = "upgrader" class = "tsd-anchor" > < / a >
< h3 > upgrader< / h3 >
< div class = "tsd-signature tsd-kind-icon" > upgrader< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > Upgrader< / span > < / div >
< aside class = "tsd-sources" >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "capturerejectionsymbol" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > < span class = "tsd-flag ts-flagReadonly" > Readonly< / span > capture< wbr > Rejection< wbr > Symbol< / h3 >
< div class = "tsd-signature tsd-kind-icon" > capture< wbr > Rejection< wbr > Symbol< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-symbol" > typeof < / span > < a href = "libp2p.html#capturerejectionsymbol" class = "tsd-signature-type" data-tsd-kind = "Property" > captureRejectionSymbol< / a > < / div >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.captureRejectionSymbol< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:273< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "capturerejections" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > capture< wbr > Rejections< / h3 >
< div class = "tsd-signature tsd-kind-icon" > capture< wbr > Rejections< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > boolean< / span > < / div >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.captureRejections< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:278< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Sets or gets the default captureRejection value for all emitters.< / p >
< / div >
< / div >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "defaultmaxlisteners" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > default< wbr > Max< wbr > Listeners< / h3 >
< div class = "tsd-signature tsd-kind-icon" > default< wbr > Max< wbr > Listeners< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-type" > number< / span > < / div >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.defaultMaxListeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:279< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "errormonitor" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > < span class = "tsd-flag ts-flagReadonly" > Readonly< / span > error< wbr > Monitor< / h3 >
< div class = "tsd-signature tsd-kind-icon" > error< wbr > Monitor< span class = "tsd-signature-symbol" > :< / span > < span class = "tsd-signature-symbol" > typeof < / span > < a href = "libp2p.html#errormonitor" class = "tsd-signature-type" data-tsd-kind = "Property" > errorMonitor< / a > < / div >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.errorMonitor< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:272< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > This symbol shall be used to install a listener for only monitoring < code > ' error' < / code >
events. Listeners installed using this symbol are called before the regular
< code > ' error' < / code > listeners are called.< / p >
< / div >
< p > Installing a listener using this symbol does not change the behavior once an
< code > ' error' < / code > event is emitted, therefore the process will still crash if no
regular < code > ' error' < / code > listener is installed.< / p >
< / div >
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Accessors< / h2 >
< section class = "tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class" >
< a name = "connections" class = "tsd-anchor" > < / a >
< h3 > connections< / h3 >
< ul class = "tsd-signatures tsd-kind-get-signature tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > get< / span > connections< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Map< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > , < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L449" > src/index.js:449< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Gets a Map of the current connections. The keys are the stringified
< code > PeerId< / code > of the peer. The value is an array of Connections to that peer.< / p >
< / div >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Map< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > , < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class" >
< a name = "multiaddrs" class = "tsd-anchor" > < / a >
< h3 > multiaddrs< / h3 >
< ul class = "tsd-signatures tsd-kind-get-signature tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > get< / span > multiaddrs< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L520" > src/index.js:520< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Get a deduplicated list of peer advertising multiaddrs by concatenating
the listen addresses used by transports with any configured
announce addresses as well as observed addresses reported by peers.< / p >
< / div >
< p > If Announce addrs are specified, configured listen addresses will be
ignored though observed addresses will still be included.< / p >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < / h4 >
< / li >
< / ul >
< / section >
< / section >
< section class = "tsd-panel-group tsd-member-group " >
< h2 > Methods< / h2 >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "_dial" class = "tsd-anchor" > < / a >
< h3 > _dial< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > _dial< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > , options< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > object< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L492" > src/index.js:492< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< dl class = "tsd-comment-tags" >
< dt > async< / dt >
< dd > < / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The peer to dial< / p >
< / div >
< / li >
< li >
< h5 > options: < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > object< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a name = "_maybeconnect" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagPrivate" > Private< / span > _maybe< wbr > Connect< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< li class = "tsd-signature tsd-kind-icon" > _maybe< wbr > Connect< span class = "tsd-signature-symbol" > (< / span > peerId< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > PeerId< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L693" > src/index.js:693< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Will dial to the given < code > peerId< / code > if the current number of
connected peers is less than the configured < code > ConnectionManager< / code >
minConnections.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peerId: < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a name = "_ondidstart" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagPrivate" > Private< / span > _on< wbr > Did< wbr > Start< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< li class = "tsd-signature tsd-kind-icon" > _on< wbr > Did< wbr > Start< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L643" > src/index.js:643< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Called when libp2p has started and before it returns< / p >
< / div >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a name = "_ondiscoverypeer" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagPrivate" > Private< / span > _on< wbr > Discovery< wbr > Peer< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< li class = "tsd-signature tsd-kind-icon" > _on< wbr > Discovery< wbr > Peer< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > { < / span > id< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > PeerId< / span > < span class = "tsd-signature-symbol" > ; < / span > multiaddrs< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L675" > src/index.js:675< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Called whenever peer discovery services emit < code > peer< / code > events.
Known peers may be emitted.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-symbol" > { < / span > id< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > PeerId< / span > < span class = "tsd-signature-symbol" > ; < / span > multiaddrs< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > ; < / span > protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > }< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter" >
< h5 > id< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< / li >
< li class = "tsd-parameter" >
< h5 > multiaddrs< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< li class = "tsd-parameter" >
< h5 > protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "_onstarting" class = "tsd-anchor" > < / a >
< h3 > _on< wbr > Starting< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > _on< wbr > Starting< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L610" > src/index.js:610< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a name = "_setuppeerdiscovery" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagPrivate" > Private< / span > _setup< wbr > Peer< wbr > Discovery< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< li class = "tsd-signature tsd-kind-icon" > _setup< wbr > Peer< wbr > Discovery< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L714" > src/index.js:714< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Initializes and starts peer discovery services< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > async< / dt >
< dd > < / dd >
< / dl >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "addlistener" class = "tsd-anchor" > < / a >
< h3 > add< wbr > Listener< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > add< wbr > Listener< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.addListener< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:299< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Alias for < code > emitter.on(eventName, listener)< / code > .< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.1.26< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "dial" class = "tsd-anchor" > < / a >
< h3 > dial< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > dial< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > , options< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-symbol" > { < / span > signal< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > AbortSignal< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L462" > src/index.js:462< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Dials to the provided peer. If successful, the known metadata of the
peer will be added to the nodes < code > peerStore< / code > < / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The peer to dial< / p >
< / div >
< / li >
< li >
< h5 > options: < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-symbol" > { < / span > signal< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > AbortSignal< / span > < span class = "tsd-signature-symbol" > }< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Connection< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "dialprotocol" class = "tsd-anchor" > < / a >
< h3 > dial< wbr > Protocol< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > dial< wbr > Protocol< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > , protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > , options< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-symbol" > { < / span > signal< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > AbortSignal< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-symbol" > { < / span > protocol< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > ; < / span > stream< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > MuxedStream< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L477" > src/index.js:477< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Dials to the provided peer and tries to handshake with the given protocols in order.
If successful, the known metadata of the peer will be added to the nodes < code > peerStore< / code > ,
and the < code > MuxedStream< / code > will be returned together with the successful negotiated protocol.< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > async< / dt >
< dd > < / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The peer to dial< / p >
< / div >
< / li >
< li >
< h5 > protocols: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< li >
< h5 > options: < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-symbol" > { < / span > signal< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > AbortSignal< / span > < span class = "tsd-signature-symbol" > }< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-symbol" > { < / span > protocol< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > ; < / span > stream< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > MuxedStream< / span > < span class = "tsd-signature-symbol" > }< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite" >
< a name = "emit" class = "tsd-anchor" > < / a >
< h3 > emit< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite" >
< li class = "tsd-signature tsd-kind-icon" > emit< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > , < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > boolean< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Overrides EventEmitter.emit< / p >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L343" > src/index.js:343< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Overrides EventEmitter.emit to conditionally emit errors
if there is a handler. If not, errors will be logged.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < / h5 >
< / li >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > boolean< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "eventnames" class = "tsd-anchor" > < / a >
< h3 > event< wbr > Names< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > event< wbr > Names< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > []< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.eventNames< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:614< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or < code > Symbol< / code > s.< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > myEE< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {});< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' bar' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {});< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > sym< / span > < span style = "color: #000000" > = < / span > < span style = "color: #267F99" > Symbol< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' symbol' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > sym< / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {});< / span >
< span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > eventNames< / span > < span style = "color: #000000" > ());< / span >
< span style = "color: #008000" > // Prints: [ ' foo' , ' bar' , Symbol(symbol) ]< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v6.0.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > []< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "getmaxlisteners" class = "tsd-anchor" > < / a >
< h3 > get< wbr > Max< wbr > Listeners< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > get< wbr > Max< wbr > Listeners< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.getMaxListeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:471< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Returns the current max listener value for the < code > EventEmitter< / code > which is either
set by < code > emitter.setMaxListeners(n)< / code > or defaults to < a href = "libp2p.html#defaultmaxlisteners" > defaultMaxListeners< / a > .< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v1.0.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > number< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "handle" class = "tsd-anchor" > < / a >
< h3 > handle< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > handle< span class = "tsd-signature-symbol" > (< / span > protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > , handler< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > props< span class = "tsd-signature-symbol" > : < / span > < a href = "../interfaces/handlerprops.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > HandlerProps< / a > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L584" > src/index.js:584< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Registers the < code > handler< / code > for each protocol< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > protocols: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< li >
< h5 > handler: < span class = "tsd-signature-symbol" > (< / span > props< span class = "tsd-signature-symbol" > : < / span > < a href = "../interfaces/handlerprops.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > HandlerProps< / a > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > props< span class = "tsd-signature-symbol" > : < / span > < a href = "../interfaces/handlerprops.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > HandlerProps< / a > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > props: < a href = "../interfaces/handlerprops.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > HandlerProps< / a > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "hangup" class = "tsd-anchor" > < / a >
< h3 > hang< wbr > Up< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > hang< wbr > Up< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L545" > src/index.js:545< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Disconnects all connections to the given < code > peer< / code > < / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > the peer to close connections to< / p >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "isstarted" class = "tsd-anchor" > < / a >
< h3 > is< wbr > Started< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > is< wbr > Started< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > boolean< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L439" > src/index.js:439< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > undefined< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > boolean< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "listenercount" class = "tsd-anchor" > < / a >
< h3 > listener< wbr > Count< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > listener< wbr > Count< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.listenerCount< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:561< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Returns the number of listeners listening to the event named < code > eventName< / code > .< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v3.2.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The name of the event being listened for< / p >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > number< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "listeners" class = "tsd-anchor" > < / a >
< h3 > listeners< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > listeners< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.listeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:484< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Returns a copy of the array of listeners for the event named < code > eventName< / code > .< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' someone connected!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > util< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > inspect< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > listeners< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > )));< / span >
< span style = "color: #008000" > // Prints: [ [Function] ]< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.1.26< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "loadkeychain" class = "tsd-anchor" > < / a >
< h3 > load< wbr > Keychain< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > load< wbr > Keychain< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L427" > src/index.js:427< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Load keychain keys from the datastore.
Imports the private key as ' self' , if needed.< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > async< / dt >
< dd > < / dd >
< / dl >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "off" class = "tsd-anchor" > < / a >
< h3 > off< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > off< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.off< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:444< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Alias for < code > emitter.removeListener()< / code > .< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v10.0.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "on" class = "tsd-anchor" > < / a >
< h3 > on< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > on< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.on< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:330< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Adds the < code > listener< / code > function to the end of the listeners array for the
event named < code > eventName< / code > . No checks are made to see if the < code > listener< / code > has
already been added. Multiple calls passing the same combination of < code > eventName< / code > and < code > listener< / code > will result in the < code > listener< / code > being added, and called, multiple
times.< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' someone connected!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< / code > < / pre >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< p > By default, event listeners are invoked in the order they are added. The< code > emitter.prependListener()< / code > method can be used as an alternative to add the
event listener to the beginning of the listeners array.< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > myEE< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' a' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > prependListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' b' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // Prints:< / span >
< span style = "color: #008000" > // b< / span >
< span style = "color: #008000" > // a< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.1.101< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The name of the event.< / p >
< / div >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The callback function< / p >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "once" class = "tsd-anchor" > < / a >
< h3 > once< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > once< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.once< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:359< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Adds a < strong > one-time< / strong > < code > listener< / code > function for the event named < code > eventName< / code > . The
next time < code > eventName< / code > is triggered, this listener is removed and then invoked.< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' Ah, we have our first user!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< / code > < / pre >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< p > By default, event listeners are invoked in the order they are added. The< code > emitter.prependOnceListener()< / code > method can be used as an alternative to add the
event listener to the beginning of the listeners array.< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > myEE< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' a' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > prependOnceListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' b' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #001080" > myEE< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // Prints:< / span >
< span style = "color: #008000" > // b< / span >
< span style = "color: #008000" > // a< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.3.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The name of the event.< / p >
< / div >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The callback function< / p >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "ping" class = "tsd-anchor" > < / a >
< h3 > ping< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > ping< span class = "tsd-signature-symbol" > (< / span > peer< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L567" > src/index.js:567< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Pings the given peer in order to obtain the operation latency.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > peer: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > Multiaddr< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > PeerId< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The peer to ping< / p >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "prependlistener" class = "tsd-anchor" > < / a >
< h3 > prepend< wbr > Listener< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > prepend< wbr > Listener< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.prependListener< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:579< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Adds the < code > listener< / code > function to the < em > beginning< / em > of the listeners array for the
event named < code > eventName< / code > . No checks are made to see if the < code > listener< / code > has
already been added. Multiple calls passing the same combination of < code > eventName< / code > and < code > listener< / code > will result in the < code > listener< / code > being added, and called, multiple
times.< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > prependListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' someone connected!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< / code > < / pre >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v6.0.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The name of the event.< / p >
< / div >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The callback function< / p >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "prependoncelistener" class = "tsd-anchor" > < / a >
< h3 > prepend< wbr > Once< wbr > Listener< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > prepend< wbr > Once< wbr > Listener< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.prependOnceListener< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:595< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Adds a < strong > one-time< / strong > < code > listener< / code > function for the event named < code > eventName< / code > to the_beginning_ of the listeners array. The next time < code > eventName< / code > is triggered, this
listener is removed, and then invoked.< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > prependOnceListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' Ah, we have our first user!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< / code > < / pre >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v6.0.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The name of the event.< / p >
< / div >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > The callback function< / p >
< / div >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "rawlisteners" class = "tsd-anchor" > < / a >
< h3 > raw< wbr > Listeners< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > raw< wbr > Listeners< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.rawListeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:514< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Returns a copy of the array of listeners for the event named < code > eventName< / code > ,
including any wrappers (such as those created by < code > .once()< / code > ).< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > emitter< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log once' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #008000" > // Returns a new Array with a function `onceWrapper` which has a property< / span >
< span style = "color: #008000" > // `listener` which contains the original listener bound above< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > listeners< / span > < span style = "color: #000000" > = < / span > < span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > rawListeners< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > logFnWrapper< / span > < span style = "color: #000000" > = < / span > < span style = "color: #001080" > listeners< / span > < span style = "color: #000000" > [< / span > < span style = "color: #098658" > 0< / span > < span style = "color: #000000" > ];< / span >
< span style = "color: #008000" > // Logs " log once" to the console and does not unbind the `once` event< / span >
< span style = "color: #001080" > logFnWrapper< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > listener< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #008000" > // Logs " log once" to the console and removes the listener< / span >
< span style = "color: #795E26" > logFnWrapper< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log persistently' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #008000" > // Will return a new Array with a single function bound by `.on()` above< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > newListeners< / span > < span style = "color: #000000" > = < / span > < span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > rawListeners< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // Logs " log persistently" twice< / span >
< span style = "color: #001080" > newListeners< / span > < span style = "color: #000000" > [< / span > < span style = "color: #098658" > 0< / span > < span style = "color: #000000" > ]();< / span >
< span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' log' < / span > < span style = "color: #000000" > );< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v9.4.0< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "removealllisteners" class = "tsd-anchor" > < / a >
< h3 > remove< wbr > All< wbr > Listeners< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > remove< wbr > All< wbr > Listeners< span class = "tsd-signature-symbol" > (< / span > event< span class = "tsd-signature-symbol" > ?: < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.removeAllListeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:455< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Removes all listeners, or those of the specified < code > eventName< / code > .< / p >
< / div >
< p > It is bad practice to remove listeners added elsewhere in the code,
particularly when the < code > EventEmitter< / code > instance was created by some other
component or module (e.g. sockets or file streams).< / p >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.1.26< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > event: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "removelistener" class = "tsd-anchor" > < / a >
< h3 > remove< wbr > Listener< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > remove< wbr > Listener< span class = "tsd-signature-symbol" > (< / span > eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , listener< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.removeListener< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:439< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Removes the specified < code > listener< / code > from the listener array for the event named< code > eventName< / code > .< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > callback< / span > < span style = "color: #000000" > = (< / span > < span style = "color: #001080" > stream< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' someone connected!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > };< / span >
< span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > callback< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // ...< / span >
< span style = "color: #001080" > server< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > removeListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' connection' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > callback< / span > < span style = "color: #000000" > );< / span >
< / code > < / pre >
< p > < code > removeListener()< / code > will remove, at most, one instance of a listener from the
listener array. If any single listener has been added multiple times to the
listener array for the specified < code > eventName< / code > , then < code > removeListener()< / code > must be
called multiple times to remove each instance.< / p >
< p > Once an event is emitted, all listeners attached to it at the
time of emitting are called in order. This implies that any< code > removeListener()< / code > or < code > removeAllListeners()< / code > calls < em > after< / em > emitting and_before_ the last listener finishes execution will
not remove them from< code > emit()< / code > in progress. Subsequent events behave as expected.< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > myEmitter< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > MyEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > callbackA< / span > < span style = "color: #000000" > = () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' A' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > removeListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > callbackB< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > };< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > callbackB< / span > < span style = "color: #000000" > = () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' B' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > };< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > callbackA< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > callbackB< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // callbackA removes listener callbackB but it will still be called.< / span >
< span style = "color: #008000" > // Internal listener array at time of emit [callbackA, callbackB]< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // Prints:< / span >
< span style = "color: #008000" > // A< / span >
< span style = "color: #008000" > // B< / span >
< span style = "color: #008000" > // callbackB is now removed.< / span >
< span style = "color: #008000" > // Internal listener array [callbackA]< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #008000" > // Prints:< / span >
< span style = "color: #008000" > // A< / span >
< / code > < / pre >
< p > Because listeners are managed using an internal array, calling this will
change the position indices of any listener registered < em > after< / em > the listener
being removed. This will not impact the order in which listeners are called,
but it means that any copies of the listener array as returned by
the < code > emitter.listeners()< / code > method will need to be recreated.< / p >
< p > When a single function has been added as a handler multiple times for a single
event (as in the example below), < code > removeListener()< / code > will remove the most
recently added instance. In the example the < code > once(' ping' )< / code > listener is removed:< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ee< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #0000FF" > function< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > pong< / span > < span style = "color: #000000" > () {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' pong' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ping' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > pong< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ping' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > pong< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > removeListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ping' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > pong< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ping' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ping' < / span > < span style = "color: #000000" > );< / span >
< / code > < / pre >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.1.26< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< li >
< h5 > listener: < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > => < / span > < span class = "tsd-signature-type" > void< / span > < / h5 >
< ul class = "tsd-parameters" >
< li class = "tsd-parameter-signature" >
< ul class = "tsd-signatures tsd-kind-type-literal tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > < span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > ...< / span > args< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > < span class = "tsd-flag ts-flagRest" > Rest< / span > < span class = "tsd-signature-symbol" > ...< / span > args: < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a name = "setmaxlisteners" class = "tsd-anchor" > < / a >
< h3 > set< wbr > Max< wbr > Listeners< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > set< wbr > Max< wbr > Listeners< span class = "tsd-signature-symbol" > (< / span > n< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.setMaxListeners< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:465< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > By default < code > EventEmitter< / code > s will print a warning if more than < code > 10< / code > listeners are
added for a particular event. This is a useful default that helps finding
memory leaks. The < code > emitter.setMaxListeners()< / code > method allows the limit to be
modified for this specific < code > EventEmitter< / code > instance. The value can be set to< code > Infinity< / code > (or < code > 0< / code > ) to indicate an unlimited number of listeners.< / p >
< / div >
< p > Returns a reference to the < code > EventEmitter< / code > , so that calls can be chained.< / p >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v0.3.5< / p >
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > n: < span class = "tsd-signature-type" > number< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < a href = "libp2p.html" class = "tsd-signature-type" data-tsd-kind = "Class" > Libp2p< / a > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "start" class = "tsd-anchor" > < / a >
< h3 > start< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > start< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L359" > src/index.js:359< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Starts the libp2p node and all its subsystems< / p >
< / div >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "stop" class = "tsd-anchor" > < / a >
< h3 > stop< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > stop< span class = "tsd-signature-symbol" > (< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L380" > src/index.js:380< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Stop the libp2p node by closing its listeners and open connections< / p >
< / div >
< dl class = "tsd-comment-tags" >
< dt > async< / dt >
< dd > < / dd >
< / dl >
< / div >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > void< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" >
< a name = "unhandle" class = "tsd-anchor" > < / a >
< h3 > unhandle< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class" >
< li class = "tsd-signature tsd-kind-icon" > unhandle< span class = "tsd-signature-symbol" > (< / span > protocols< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > void< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L600" > src/index.js:600< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Removes the handler for each protocol. The protocol
will no longer be supported on streams.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > protocols: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > []< / span > < / h5 >
< div class = "tsd-comment tsd-typography" >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > void< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static" >
< a name = "create" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > create< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static" >
< li class = "tsd-signature tsd-kind-icon" > create< span class = "tsd-signature-symbol" > (< / span > options< span class = "tsd-signature-symbol" > : < / span > < a href = "../interfaces/libp2poptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > Libp2pOptions< / a > < span class = "tsd-signature-symbol" > & < / span > < a href = "../interfaces/createoptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > CreateOptions< / a > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Libp2p< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< ul >
2021-09-21 09:46:53 +02:00
< li > Defined in < a href = "https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L141" > src/index.js:141< / a > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Like < code > new Libp2p(options)< / code > except it will create a < code > PeerId< / code >
instance if one is not provided in options.< / p >
< / div >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > options: < a href = "../interfaces/libp2poptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > Libp2pOptions< / a > < span class = "tsd-signature-symbol" > & < / span > < a href = "../interfaces/createoptions.html" class = "tsd-signature-type" data-tsd-kind = "Interface" > CreateOptions< / a > < / h5 >
< div class = "tsd-comment tsd-typography" >
< p > Libp2p configuration options< / p >
< / div >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > Libp2p< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
2021-09-03 10:05:01 +02:00
< a name = "geteventlisteners" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > get< wbr > Event< wbr > Listeners< / h3 >
2021-08-20 09:25:06 +02:00
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
2021-09-03 10:05:01 +02:00
< li class = "tsd-signature tsd-kind-icon" > get< wbr > Event< wbr > Listeners< span class = "tsd-signature-symbol" > (< / span > emitter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > DOMEventTarget< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > EventEmitter< / span > , name< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / li >
2021-08-20 09:25:06 +02:00
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
2021-09-03 10:05:01 +02:00
< p > Inherited from EventEmitter.getEventListeners< / p >
2021-08-20 09:25:06 +02:00
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:262< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
2021-09-03 10:05:01 +02:00
< p > Returns a copy of the array of listeners for the event named < code > eventName< / code > .< / p >
2021-08-20 09:25:06 +02:00
< / div >
2021-09-03 10:05:01 +02:00
< p > For < code > EventEmitter< / code > s this behaves exactly the same as calling < code > .listeners< / code > on
the emitter.< / p >
< p > For < code > EventTarget< / code > s this is the only way to get the event listeners for the
event target. This is useful for debugging and diagnostic purposes.< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > { < / span > < span style = "color: #0070C1" > getEventListeners< / span > < span style = "color: #000000" > , < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > } = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ee< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > listener< / span > < span style = "color: #000000" > = () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' Events are fun' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > listener< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #795E26" > getEventListeners< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > ); < / span > < span style = "color: #008000" > // [listener]< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > et< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventTarget< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > listener< / span > < span style = "color: #000000" > = () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' Events are fun' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > et< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > addEventListener< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > listener< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #795E26" > getEventListeners< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > et< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > ); < / span > < span style = "color: #008000" > // [listener]< / span >
< span style = "color: #000000" > }< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v15.2.0< / p >
< / dd >
< / dl >
2021-08-20 09:25:06 +02:00
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > emitter: < span class = "tsd-signature-type" > DOMEventTarget< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > EventEmitter< / span > < / h5 >
< / li >
< li >
< h5 > name: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Function< / span > < span class = "tsd-signature-symbol" > []< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "listenercount-1" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > listener< wbr > Count< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > listener< wbr > Count< span class = "tsd-signature-symbol" > (< / span > emitter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > EventEmitter< / span > , eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > number< / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.listenerCount< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:234< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< div class = "tsd-comment tsd-typography" >
2021-09-03 10:05:01 +02:00
< div class = "lead" >
< p > A class method that returns the number of listeners for the given < code > eventName< / code > registered on the given < code > emitter< / code > .< / p >
< / div >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > { < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #0070C1" > listenerCount< / span > < span style = "color: #000000" > } = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > myEmitter< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {});< / span >
< span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > on< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > , () < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {});< / span >
< span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #795E26" > listenerCount< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > myEmitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' event' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #008000" > // Prints: 2< / span >
< / code > < / pre >
2021-08-20 09:25:06 +02:00
< dl class = "tsd-comment-tags" >
2021-09-03 10:05:01 +02:00
< dt > since< / dt >
< dd > < p > v0.9.12< / p >
< / dd >
2021-08-20 09:25:06 +02:00
< dt > deprecated< / dt >
2021-09-03 10:05:01 +02:00
< dd > < p > Since v3.2.0 - Use < code > listenerCount< / code > instead.< / p >
2021-08-20 09:25:06 +02:00
< / dd >
< / dl >
< / div >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > emitter: < span class = "tsd-signature-type" > EventEmitter< / span > < / h5 >
2021-09-03 10:05:01 +02:00
< div class = "tsd-comment tsd-typography" >
< p > The emitter to query< / p >
< / div >
2021-08-20 09:25:06 +02:00
< / li >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
2021-09-03 10:05:01 +02:00
< div class = "tsd-comment tsd-typography" >
< p > The event name< / p >
< / div >
2021-08-20 09:25:06 +02:00
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > number< / span > < / h4 >
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "on-1" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > on< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > on< span class = "tsd-signature-symbol" > (< / span > emitter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > EventEmitter< / span > , eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > , options< span class = "tsd-signature-symbol" > ?: < / span > < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > AsyncIterableIterator< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.on< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:217< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
2021-09-03 10:05:01 +02:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > ```js
const { on, EventEmitter } = require(' events' );< / p >
< / div >
< p > (async () => {
const ee = new EventEmitter();< / p >
< p > // Emit later on
process.nextTick(() => {
ee.emit(' foo' , ' bar' );
ee.emit(' foo' , 42);
});< / p >
< p > for await (const event of on(ee, ' foo' )) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints [' bar' ] [42]
}
// Unreachable here
})();< / p >
< pre > < code >
< span style = "color: #001080" > Returns< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > an< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `AsyncIterator`< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > that< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > iterates< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `eventName`< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > events< / span > < span style = "color: #000000" > . < / span > < span style = "color: #001080" > It< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > will< / span > < span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > throw< / span >
< span style = "color: #AF00DB" > if< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > the< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `EventEmitter`< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > emits< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `' error' `< / span > < span style = "color: #000000" > . < / span > < span style = "color: #001080" > It< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > removes< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > all< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > listeners< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > when< / span >
< span style = "color: #001080" > exiting< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > the< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > loop< / span > < span style = "color: #000000" > . < / span > < span style = "color: #001080" > The< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `value`< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > returned< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > by< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > each< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > iteration< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > is< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > an< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > array< / span >
< span style = "color: #001080" > composed< / span > < span style = "color: #000000" > < / span > < span style = "color: #0000FF" > of< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > the< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > emitted< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > event< / span > < span style = "color: #000000" > < / span > < span style = "color: #0000FF" > arguments< / span > < span style = "color: #000000" > .< / span >
< span style = "color: #001080" > An< / span > < span style = "color: #000000" > < / span > < span style = "color: #A31515" > `AbortSignal`< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > can< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > be< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > used< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > to< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > cancel< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > waiting< / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > on< / span > < span style = "color: #000000" > events:< / span >
< span style = "color: #A31515" > ```js< / span >
< span style = "color: #A31515" > const { on, EventEmitter } = require(' events' );< / span >
< span style = "color: #A31515" > const ac = new AbortController();< / span >
< span style = "color: #A31515" > (async () => {< / span >
< span style = "color: #A31515" > const ee = new EventEmitter();< / span >
< span style = "color: #A31515" > // Emit later on< / span >
< span style = "color: #A31515" > process.nextTick(() => {< / span >
< span style = "color: #A31515" > ee.emit(' foo' , ' bar' );< / span >
< span style = "color: #A31515" > ee.emit(' foo' , 42);< / span >
< span style = "color: #A31515" > });< / span >
< span style = "color: #A31515" > for await (const event of on(ee, ' foo' , { signal: ac.signal })) {< / span >
< span style = "color: #A31515" > // The execution of this inner block is synchronous and it< / span >
< span style = "color: #A31515" > // processes one event at a time (even with await). Do not use< / span >
< span style = "color: #A31515" > // if concurrent execution is required.< / span >
< span style = "color: #A31515" > console.log(event); // prints [' bar' ] [42]< / span >
< span style = "color: #A31515" > }< / span >
< span style = "color: #A31515" > // Unreachable here< / span >
< span style = "color: #A31515" > })();< / span >
< span style = "color: #A31515" > process.nextTick(() => ac.abort());< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v13.6.0, v12.16.0< / p >
< / dd >
< / dl >
< / div >
2021-08-20 09:25:06 +02:00
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > emitter: < span class = "tsd-signature-type" > EventEmitter< / span > < / h5 >
< / li >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < / h5 >
2021-09-03 10:05:01 +02:00
< div class = "tsd-comment tsd-typography" >
< p > The name of the event being listened for< / p >
< / div >
2021-08-20 09:25:06 +02:00
< / li >
< li >
< h5 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > options: < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > AsyncIterableIterator< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
2021-09-03 10:05:01 +02:00
< p > that iterates < code > eventName< / code > events emitted by the < code > emitter< / code > < / p >
2021-08-20 09:25:06 +02:00
< / li >
< / ul >
< / section >
< section class = "tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a name = "once-1" class = "tsd-anchor" > < / a >
< h3 > < span class = "tsd-flag ts-flagStatic" > Static< / span > once< / h3 >
< ul class = "tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< li class = "tsd-signature tsd-kind-icon" > once< span class = "tsd-signature-symbol" > (< / span > emitter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > NodeEventTarget< / span > , eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > , options< span class = "tsd-signature-symbol" > ?: < / span > < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< li class = "tsd-signature tsd-kind-icon" > once< span class = "tsd-signature-symbol" > (< / span > emitter< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > DOMEventTarget< / span > , eventName< span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > string< / span > , options< span class = "tsd-signature-symbol" > ?: < / span > < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < span class = "tsd-signature-symbol" > )< / span > < span class = "tsd-signature-symbol" > : < / span > < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / li >
< / ul >
< ul class = "tsd-descriptions" >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.once< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:157< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
2021-09-03 10:05:01 +02:00
< div class = "tsd-comment tsd-typography" >
< div class = "lead" >
< p > Creates a < code > Promise< / code > that is fulfilled when the < code > EventEmitter< / code > emits the given
event or that is rejected if the < code > EventEmitter< / code > emits < code > ' error' < / code > while waiting.
The < code > Promise< / code > will resolve with an array of all the arguments emitted to the
given event.< / p >
< / div >
2021-09-21 09:46:53 +02:00
< p > This method is intentionally generic and works with the web platform < a href = "https://dom.spec.whatwg.org/#interface-eventtarget" > EventTarget< / a > interface, which has no special< code > ' error' < / code > event
2021-09-03 10:05:01 +02:00
semantics and does not listen to the < code > ' error' < / code > event.< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > { < / span > < span style = "color: #0070C1" > once< / span > < span style = "color: #000000" > , < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > } = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > async< / span > < span style = "color: #000000" > < / span > < span style = "color: #0000FF" > function< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > run< / span > < span style = "color: #000000" > () {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ee< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > process< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > nextTick< / span > < span style = "color: #000000" > (() < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' myevent' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #098658" > 42< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > [< / span > < span style = "color: #0070C1" > value< / span > < span style = "color: #000000" > ] = < / span > < span style = "color: #AF00DB" > await< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' myevent' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > value< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > err< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #267F99" > Error< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' kaboom' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > process< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > nextTick< / span > < span style = "color: #000000" > (() < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' error' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > });< / span >
< span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > try< / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > await< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' myevent' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > } < / span > < span style = "color: #AF00DB" > catch< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > ) {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' error happened' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #795E26" > run< / span > < span style = "color: #000000" > ();< / span >
< / code > < / pre >
< p > The special handling of the < code > ' error' < / code > event is only used when < code > events.once()< / code > is used to wait for another event. If < code > events.once()< / code > is used to wait for the
' < code > error' < / code > event itself, then it is treated as any other kind of event without
special handling:< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > { < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #0070C1" > once< / span > < span style = "color: #000000" > } = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ee< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' error' < / span > < span style = "color: #000000" > )< / span >
< span style = "color: #000000" > .< / span > < span style = "color: #795E26" > then< / span > < span style = "color: #000000" > (([< / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > ]) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' ok' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > .< / span > < span style = "color: #001080" > message< / span > < span style = "color: #000000" > ))< / span >
< span style = "color: #000000" > .< / span > < span style = "color: #795E26" > catch< / span > < span style = "color: #000000" > ((< / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > ) < / span > < span style = "color: #0000FF" > => < / span > < span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' error' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > err< / span > < span style = "color: #000000" > .< / span > < span style = "color: #001080" > message< / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' error' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #267F99" > Error< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' boom' < / span > < span style = "color: #000000" > ));< / span >
< span style = "color: #008000" > // Prints: ok boom< / span >
< / code > < / pre >
< p > An < code > AbortSignal< / code > can be used to cancel waiting for the event:< / p >
< pre > < code class = "language-js" > < span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > { < / span > < span style = "color: #0070C1" > EventEmitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #0070C1" > once< / span > < span style = "color: #000000" > } = < / span > < span style = "color: #795E26" > require< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' events' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ee< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > EventEmitter< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #0000FF" > const< / span > < span style = "color: #000000" > < / span > < span style = "color: #0070C1" > ac< / span > < span style = "color: #000000" > = < / span > < span style = "color: #0000FF" > new< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > AbortController< / span > < span style = "color: #000000" > ();< / span >
< span style = "color: #0000FF" > async< / span > < span style = "color: #000000" > < / span > < span style = "color: #0000FF" > function< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > foo< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > event< / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > signal< / span > < span style = "color: #000000" > ) {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > try< / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > await< / span > < span style = "color: #000000" > < / span > < span style = "color: #795E26" > once< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > emitter< / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > event< / span > < span style = "color: #000000" > , { < / span > < span style = "color: #001080" > signal< / span > < span style = "color: #000000" > });< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > log< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' event emitted!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > } < / span > < span style = "color: #AF00DB" > catch< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > error< / span > < span style = "color: #000000" > ) {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #AF00DB" > if< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > error< / span > < span style = "color: #000000" > .< / span > < span style = "color: #001080" > name< / span > < span style = "color: #000000" > === < / span > < span style = "color: #A31515" > ' AbortError' < / span > < span style = "color: #000000" > ) {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > error< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' Waiting for the event was canceled!' < / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > } < / span > < span style = "color: #AF00DB" > else< / span > < span style = "color: #000000" > {< / span >
< span style = "color: #000000" > < / span > < span style = "color: #001080" > console< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > error< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' There was an error' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > error< / span > < span style = "color: #000000" > .< / span > < span style = "color: #001080" > message< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #000000" > }< / span >
< span style = "color: #795E26" > foo< / span > < span style = "color: #000000" > (< / span > < span style = "color: #001080" > ee< / span > < span style = "color: #000000" > , < / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > , < / span > < span style = "color: #001080" > ac< / span > < span style = "color: #000000" > .< / span > < span style = "color: #001080" > signal< / span > < span style = "color: #000000" > );< / span >
< span style = "color: #001080" > ac< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > abort< / span > < span style = "color: #000000" > (); < / span > < span style = "color: #008000" > // Abort waiting for the event< / span >
< span style = "color: #001080" > ee< / span > < span style = "color: #000000" > .< / span > < span style = "color: #795E26" > emit< / span > < span style = "color: #000000" > (< / span > < span style = "color: #A31515" > ' foo' < / span > < span style = "color: #000000" > ); < / span > < span style = "color: #008000" > // Prints: Waiting for the event was canceled!< / span >
< / code > < / pre >
< dl class = "tsd-comment-tags" >
< dt > since< / dt >
< dd > < p > v11.13.0, v10.16.0< / p >
< / dd >
< / dl >
< / div >
2021-08-20 09:25:06 +02:00
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > emitter: < span class = "tsd-signature-type" > NodeEventTarget< / span > < / h5 >
< / li >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < span class = "tsd-signature-symbol" > | < / span > < span class = "tsd-signature-type" > symbol< / span > < / h5 >
< / li >
< li >
< h5 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > options: < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< li class = "tsd-description" >
< aside class = "tsd-sources" >
< p > Inherited from EventEmitter.once< / p >
< ul >
2021-09-03 10:05:01 +02:00
< li > Defined in node_modules/@types/node/events.d.ts:158< / li >
2021-08-20 09:25:06 +02:00
< / ul >
< / aside >
< h4 class = "tsd-parameters-title" > Parameters< / h4 >
< ul class = "tsd-parameters" >
< li >
< h5 > emitter: < span class = "tsd-signature-type" > DOMEventTarget< / span > < / h5 >
< / li >
< li >
< h5 > eventName: < span class = "tsd-signature-type" > string< / span > < / h5 >
< / li >
< li >
< h5 > < span class = "tsd-flag ts-flagOptional" > Optional< / span > options: < span class = "tsd-signature-type" > StaticEventEmitterOptions< / span > < / h5 >
< / li >
< / ul >
< h4 class = "tsd-returns-title" > Returns < span class = "tsd-signature-type" > Promise< / span > < span class = "tsd-signature-symbol" > < < / span > < span class = "tsd-signature-type" > any< / span > < span class = "tsd-signature-symbol" > []< / span > < span class = "tsd-signature-symbol" > > < / span > < / h4 >
< / li >
< / ul >
< / section >
< / section >
< / div >
< div class = "col-4 col-menu menu-sticky-wrap menu-highlight" >
< nav class = "tsd-navigation primary" >
< ul >
< li class = " " >
< a href = "../modules.html" > Exports< / a >
< / li >
< / ul >
< / nav >
< nav class = "tsd-navigation secondary menu-sticky" >
< ul class = "before-current" >
< / ul >
< ul class = "current" >
< li class = "current tsd-kind-class" >
< a href = "libp2p.html" class = "tsd-kind-icon" > Libp2p< / a >
< ul >
< li class = " tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite" >
< a href = "libp2p.html#constructor" class = "tsd-kind-icon" > constructor< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_config" class = "tsd-kind-icon" > _config< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_dht" class = "tsd-kind-icon" > _dht< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_discovery" class = "tsd-kind-icon" > _discovery< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_isstarted" class = "tsd-kind-icon" > _is< wbr > Started< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_modules" class = "tsd-kind-icon" > _modules< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_options" class = "tsd-kind-icon" > _options< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#_transport" class = "tsd-kind-icon" > _transport< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#addressmanager" class = "tsd-kind-icon" > address< wbr > Manager< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#addresses" class = "tsd-kind-icon" > addresses< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#connectionmanager" class = "tsd-kind-icon" > connection< wbr > Manager< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#contentrouting" class = "tsd-kind-icon" > content< wbr > Routing< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#datastore" class = "tsd-kind-icon" > datastore< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#dialer" class = "tsd-kind-icon" > dialer< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#identifyservice" class = "tsd-kind-icon" > identify< wbr > Service< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#keychain" class = "tsd-kind-icon" > keychain< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#metrics" class = "tsd-kind-icon" > metrics< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#natmanager" class = "tsd-kind-icon" > nat< wbr > Manager< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#peerid" class = "tsd-kind-icon" > peer< wbr > Id< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#peerrouting" class = "tsd-kind-icon" > peer< wbr > Routing< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#peerstore" class = "tsd-kind-icon" > peer< wbr > Store< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#pubsub" class = "tsd-kind-icon" > pubsub< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#registrar" class = "tsd-kind-icon" > registrar< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#relay" class = "tsd-kind-icon" > relay< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#transportmanager" class = "tsd-kind-icon" > transport< wbr > Manager< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class" >
< a href = "libp2p.html#upgrader" class = "tsd-kind-icon" > upgrader< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#capturerejectionsymbol" class = "tsd-kind-icon" > capture< wbr > Rejection< wbr > Symbol< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#capturerejections" class = "tsd-kind-icon" > capture< wbr > Rejections< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#defaultmaxlisteners" class = "tsd-kind-icon" > default< wbr > Max< wbr > Listeners< / a >
< / li >
< li class = " tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#errormonitor" class = "tsd-kind-icon" > error< wbr > Monitor< / a >
< / li >
< li class = " tsd-kind-get-signature tsd-parent-kind-class" >
< a href = "libp2p.html#connections" class = "tsd-kind-icon" > connections< / a >
< / li >
< li class = " tsd-kind-get-signature tsd-parent-kind-class" >
< a href = "libp2p.html#multiaddrs" class = "tsd-kind-icon" > multiaddrs< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#_dial" class = "tsd-kind-icon" > _dial< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a href = "libp2p.html#_maybeconnect" class = "tsd-kind-icon" > _maybe< wbr > Connect< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a href = "libp2p.html#_ondidstart" class = "tsd-kind-icon" > _on< wbr > Did< wbr > Start< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a href = "libp2p.html#_ondiscoverypeer" class = "tsd-kind-icon" > _on< wbr > Discovery< wbr > Peer< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#_onstarting" class = "tsd-kind-icon" > _on< wbr > Starting< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-private" >
< a href = "libp2p.html#_setuppeerdiscovery" class = "tsd-kind-icon" > _setup< wbr > Peer< wbr > Discovery< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#addlistener" class = "tsd-kind-icon" > add< wbr > Listener< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#dial" class = "tsd-kind-icon" > dial< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#dialprotocol" class = "tsd-kind-icon" > dial< wbr > Protocol< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-overwrite" >
< a href = "libp2p.html#emit" class = "tsd-kind-icon" > emit< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#eventnames" class = "tsd-kind-icon" > event< wbr > Names< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#getmaxlisteners" class = "tsd-kind-icon" > get< wbr > Max< wbr > Listeners< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#handle" class = "tsd-kind-icon" > handle< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#hangup" class = "tsd-kind-icon" > hang< wbr > Up< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#isstarted" class = "tsd-kind-icon" > is< wbr > Started< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#listenercount" class = "tsd-kind-icon" > listener< wbr > Count< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#listeners" class = "tsd-kind-icon" > listeners< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#loadkeychain" class = "tsd-kind-icon" > load< wbr > Keychain< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#off" class = "tsd-kind-icon" > off< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#on" class = "tsd-kind-icon" > on< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#once" class = "tsd-kind-icon" > once< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#ping" class = "tsd-kind-icon" > ping< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#prependlistener" class = "tsd-kind-icon" > prepend< wbr > Listener< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#prependoncelistener" class = "tsd-kind-icon" > prepend< wbr > Once< wbr > Listener< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#rawlisteners" class = "tsd-kind-icon" > raw< wbr > Listeners< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#removealllisteners" class = "tsd-kind-icon" > remove< wbr > All< wbr > Listeners< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#removelistener" class = "tsd-kind-icon" > remove< wbr > Listener< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external" >
< a href = "libp2p.html#setmaxlisteners" class = "tsd-kind-icon" > set< wbr > Max< wbr > Listeners< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#start" class = "tsd-kind-icon" > start< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#stop" class = "tsd-kind-icon" > stop< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class" >
< a href = "libp2p.html#unhandle" class = "tsd-kind-icon" > unhandle< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-static" >
< a href = "libp2p.html#create" class = "tsd-kind-icon" > create< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
2021-09-03 10:05:01 +02:00
< a href = "libp2p.html#geteventlisteners" class = "tsd-kind-icon" > get< wbr > Event< wbr > Listeners< / a >
2021-08-20 09:25:06 +02:00
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#listenercount-1" class = "tsd-kind-icon" > listener< wbr > Count< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#on-1" class = "tsd-kind-icon" > on< / a >
< / li >
< li class = " tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external" >
< a href = "libp2p.html#once-1" class = "tsd-kind-icon" > once< / a >
< / li >
< / ul >
< / li >
< / ul >
< ul class = "after-current" >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/createoptions.html" class = "tsd-kind-icon" > Create< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/dhtoptions.html" class = "tsd-kind-icon" > Dht< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/handlerprops.html" class = "tsd-kind-icon" > Handler< wbr > Props< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/keychainoptions.html" class = "tsd-kind-icon" > Keychain< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/libp2pconfig.html" class = "tsd-kind-icon" > Libp2p< wbr > Config< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/libp2pmodules.html" class = "tsd-kind-icon" > Libp2p< wbr > Modules< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/libp2poptions.html" class = "tsd-kind-icon" > Libp2p< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/metricsoptions.html" class = "tsd-kind-icon" > Metrics< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/peerstoreoptions.html" class = "tsd-kind-icon" > Peer< wbr > Store< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/pubsublocaloptions.html" class = "tsd-kind-icon" > Pubsub< wbr > Local< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/randomwalkoptions.html" class = "tsd-kind-icon" > Random< wbr > Walk< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/relayoptions.html" class = "tsd-kind-icon" > Relay< wbr > Options< / a >
< / li >
< li class = " tsd-kind-interface tsd-has-type-parameter" >
< a href = "../interfaces/constructoroptions.html" class = "tsd-kind-icon" > constructor< wbr > Options< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#connection" class = "tsd-kind-icon" > Connection< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#contentroutingmodule" class = "tsd-kind-icon" > Content< wbr > Routing< wbr > Module< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#crypto" class = "tsd-kind-icon" > Crypto< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#datastore" class = "tsd-kind-icon" > Datastore< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#muxedstream" class = "tsd-kind-icon" > Muxed< wbr > Stream< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#muxerfactory" class = "tsd-kind-icon" > Muxer< wbr > Factory< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#peerdiscoveryfactory" class = "tsd-kind-icon" > Peer< wbr > Discovery< wbr > Factory< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#peerroutingmodule" class = "tsd-kind-icon" > Peer< wbr > Routing< wbr > Module< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#protector" class = "tsd-kind-icon" > Protector< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#pubsub" class = "tsd-kind-icon" > Pubsub< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#pubsuboptions" class = "tsd-kind-icon" > Pubsub< wbr > Options< / a >
< / li >
< li class = " tsd-kind-type-alias tsd-has-type-parameter" >
< a href = "../modules.html#transportfactory" class = "tsd-kind-icon" > Transport< wbr > Factory< / a >
< / li >
< / ul >
< / nav >
< / div >
< / div >
< / div >
< footer >
< div class = "container" >
< h2 > Legend< / h2 >
< div class = "tsd-legend-group" >
< ul class = "tsd-legend" >
< li class = "tsd-kind-constructor tsd-parent-kind-class" > < span class = "tsd-kind-icon" > Constructor< / span > < / li >
< li class = "tsd-kind-property tsd-parent-kind-class" > < span class = "tsd-kind-icon" > Property< / span > < / li >
< li class = "tsd-kind-method tsd-parent-kind-class" > < span class = "tsd-kind-icon" > Method< / span > < / li >
< / ul >
< ul class = "tsd-legend" >
< li class = "tsd-kind-property tsd-parent-kind-interface" > < span class = "tsd-kind-icon" > Property< / span > < / li >
< / ul >
< ul class = "tsd-legend" >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-private" > < span class = "tsd-kind-icon" > Private method< / span > < / li >
< / ul >
< ul class = "tsd-legend" >
< li class = "tsd-kind-method tsd-parent-kind-class tsd-is-static" > < span class = "tsd-kind-icon" > Static method< / span > < / li >
< / ul >
< / div >
< / div >
< / footer >
< div class = "overlay" > < / div >
< script src = "../assets/js/main.js" > < / script >
< / body >
< / html >