From 4f568a9ff9cbb727f0e7c1c1103af4665ea53bcc Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 3 Sep 2021 10:05:01 +0200 Subject: [PATCH] chore: update documentation --- classes/libp2p.html | 300 +++++++++++++++++++++++------ index.html | 8 +- interfaces/constructoroptions.html | 10 +- interfaces/createoptions.html | 10 +- interfaces/dhtoptions.html | 20 +- interfaces/handlerprops.html | 14 +- interfaces/keychainoptions.html | 10 +- interfaces/libp2pconfig.html | 20 +- interfaces/libp2pmodules.html | 26 +-- interfaces/libp2poptions.html | 32 +-- interfaces/metricsoptions.html | 10 +- interfaces/peerstoreoptions.html | 10 +- interfaces/pubsublocaloptions.html | 10 +- interfaces/randomwalkoptions.html | 16 +- interfaces/relayoptions.html | 16 +- modules.html | 32 +-- 16 files changed, 364 insertions(+), 180 deletions(-) diff --git a/classes/libp2p.html b/classes/libp2p.html index b0299828..cbebe4e8 100644 --- a/classes/libp2p.html +++ b/classes/libp2p.html @@ -3,8 +3,8 @@ - Libp2p | libp2p - v0.32.4 - + Libp2p | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
  • Preparing search index...
  • The search index is not available
  • - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • Libp2p @@ -326,7 +326,7 @@
    • stop
    • unhandle
    • create
    • -
    • getEventListener
    • +
    • getEventListeners
    • listenerCount
    • on
    • once
    • @@ -348,7 +348,7 @@
      @@ -374,7 +374,7 @@

      _config

      -
      _config: { dht: { enabled: boolean; kBucketSize: number; randomWalk: { enabled: boolean; interval: number; queriesPerPeriod: number; timeout: number } }; nat: { enabled: boolean; externalIp: null; gateway: null; keepAlive: boolean; pmp: { enabled: boolean }; ttl: number }; peerDiscovery: { autoDial: boolean }; protocolPrefix: string; pubsub: { enabled: boolean }; relay: { advertise: { bootDelay: number; enabled: boolean; ttl: number }; autoRelay: { enabled: boolean; maxListeners: number }; enabled: boolean; hop: { active: boolean; enabled: boolean } }; transport: {} } & Libp2pConfig
      +
      _config: { dht: { enabled: boolean; kBucketSize: number; randomWalk: { enabled: boolean; interval: number; queriesPerPeriod: number; timeout: number } }; nat: { enabled: boolean; externalIp: null; gateway: null; keepAlive: boolean; pmp: { enabled: boolean }; ttl: number }; peerDiscovery: { autoDial: boolean }; pubsub: { enabled: boolean }; relay: { advertise: { bootDelay: number; enabled: boolean; ttl: number }; autoRelay: { enabled: boolean; maxListeners: number }; enabled: boolean; hop: { active: boolean; enabled: boolean } }; transport: {} } & Libp2pConfig
      @@ -409,7 +409,7 @@

      _options

      -
      _options: { addresses: { announce: never[]; announceFilter: (multiaddrs: Multiaddr[]) => Multiaddr[]; listen: never[]; noAnnounce: never[] }; config: { dht: { enabled: boolean; kBucketSize: number; randomWalk: { enabled: boolean; interval: number; queriesPerPeriod: number; timeout: number } }; nat: { enabled: boolean; externalIp: null; gateway: null; keepAlive: boolean; pmp: { enabled: boolean }; ttl: number }; peerDiscovery: { autoDial: boolean }; protocolPrefix: string; pubsub: { enabled: boolean }; relay: { advertise: { bootDelay: number; enabled: boolean; ttl: number }; autoRelay: { enabled: boolean; maxListeners: number }; enabled: boolean; hop: { active: boolean; enabled: boolean } }; transport: {} }; connectionManager: { minConnections: number }; dialer: { addressSorter: (addresses: Address[]) => Address[]; dialTimeout: number; maxDialsPerPeer: number; maxParallelDials: number; resolvers: { dnsaddr: any } }; host: { agentVersion: string }; metrics: { enabled: boolean }; peerRouting: { refreshManager: { bootDelay: number; enabled: boolean; interval: number } }; peerStore: { persistence: boolean; threshold: number }; transportManager: { faultTolerance: number } } & Libp2pOptions & constructorOptions
      +
      _options: { addresses: { announce: never[]; announceFilter: (multiaddrs: Multiaddr[]) => Multiaddr[]; listen: never[]; noAnnounce: never[] }; config: { dht: { enabled: boolean; kBucketSize: number; randomWalk: { enabled: boolean; interval: number; queriesPerPeriod: number; timeout: number } }; nat: { enabled: boolean; externalIp: null; gateway: null; keepAlive: boolean; pmp: { enabled: boolean }; ttl: number }; peerDiscovery: { autoDial: boolean }; pubsub: { enabled: boolean }; relay: { advertise: { bootDelay: number; enabled: boolean; ttl: number }; autoRelay: { enabled: boolean; maxListeners: number }; enabled: boolean; hop: { active: boolean; enabled: boolean } }; transport: {} }; connectionManager: { minConnections: number }; dialer: { addressSorter: (addresses: Address[]) => Address[]; dialTimeout: number; maxDialsPerPeer: number; maxParallelDials: number; resolvers: { dnsaddr: any } }; host: { agentVersion: string }; metrics: { enabled: boolean }; peerRouting: { refreshManager: { bootDelay: number; enabled: boolean; interval: number } }; peerStore: { persistence: boolean; threshold: number }; transportManager: { faultTolerance: number } } & Libp2pOptions & constructorOptions
      @@ -553,7 +553,7 @@ @@ -564,7 +564,7 @@
      @@ -580,7 +580,7 @@ @@ -591,7 +591,7 @@
      @@ -618,7 +618,7 @@
    • @@ -641,7 +641,7 @@
    • @@ -670,7 +670,7 @@
    • @@ -705,7 +705,7 @@
    • @@ -737,7 +737,7 @@
    • @@ -759,7 +759,7 @@
    • @@ -801,7 +801,7 @@
    • Returns Promise<void>

      @@ -818,7 +818,7 @@
    • @@ -845,7 +845,7 @@
      @@ -899,7 +899,7 @@
    • @@ -934,7 +934,7 @@
    • @@ -978,7 +978,7 @@
      @@ -1011,7 +1011,7 @@
      @@ -1051,7 +1051,7 @@
      @@ -1079,7 +1079,7 @@
    • @@ -1130,7 +1130,7 @@
    • @@ -1161,7 +1161,7 @@
    • Returns undefined | boolean

      @@ -1179,7 +1179,7 @@
      @@ -1216,7 +1216,7 @@
      @@ -1255,7 +1255,7 @@
    • @@ -1283,7 +1283,7 @@
      @@ -1338,7 +1338,7 @@
      @@ -1417,7 +1417,7 @@
      @@ -1493,7 +1493,7 @@
    • @@ -1525,7 +1525,7 @@
      @@ -1594,7 +1594,7 @@
      @@ -1661,7 +1661,7 @@
      @@ -1718,7 +1718,7 @@
      @@ -1756,7 +1756,7 @@
      @@ -1875,7 +1875,7 @@
      @@ -1912,7 +1912,7 @@
    • @@ -1934,7 +1934,7 @@
    • @@ -1960,7 +1960,7 @@
    • @@ -1991,7 +1991,7 @@
    • @@ -2014,23 +2014,47 @@
    - -

    Static getEventListener

    + +

    Static getEventListeners

      -
    • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
    • +
    • getEventListeners(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
    • -

      Returns a list listener for a specific emitter event name.

      +

      Returns a copy of the array of listeners for the event named eventName.

      +

      For EventEmitters this behaves exactly the same as calling .listeners on + the emitter.

      +

      For EventTargets this is the only way to get the event listeners for the + event target. This is useful for debugging and diagnostic purposes.

      +
      const { getEventListeners, EventEmitter } = require('events');
      +
      +{
      +  const ee = new EventEmitter();
      +  const listener = () => console.log('Events are fun');
      +  ee.on('foo', listener);
      +  getEventListeners(ee, 'foo'); // [listener]
      +}
      +{
      +  const et = new EventTarget();
      +  const listener = () => console.log('Events are fun');
      +  et.addEventListener('foo', listener);
      +  getEventListeners(et, 'foo'); // [listener]
      +}
      +
      +
      +
      since
      +

      v15.2.0

      +
      +

      Parameters

        @@ -2056,13 +2080,26 @@
        +
        +

        A class method that returns the number of listeners for the given eventNameregistered on the given emitter.

        +
        +
        const { EventEmitter, listenerCount } = require('events');
        +const myEmitter = new EventEmitter();
        +myEmitter.on('event', () => {});
        +myEmitter.on('event', () => {});
        +console.log(listenerCount(myEmitter, 'event'));
        +// Prints: 2
        +
        +
        since
        +

        v0.9.12

        +
        deprecated
        -

        since v4.0.0

        +

        Since v3.2.0 - Use listenerCount instead.

        @@ -2070,9 +2107,15 @@
        • emitter: EventEmitter
          +
          +

          The emitter to query

          +
        • eventName: string | symbol
          +
          +

          The event name

          +

        Returns number

        @@ -2090,9 +2133,67 @@ +
        +
        +

        ```js + const { on, EventEmitter } = require('events');

        +
        +

        (async () => { + const ee = new EventEmitter();

        +

        // Emit later on + process.nextTick(() => { + ee.emit('foo', 'bar'); + ee.emit('foo', 42); + });

        +

        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 + })();

        +
        
        +Returns an `AsyncIterator` that iterates `eventName` events. It will throw
        +if the `EventEmitter` emits `'error'`. It removes all listeners when
        +exiting the loop. The `value` returned by each iteration is an array
        +composed of the emitted event arguments.
        +
        +An `AbortSignal` can be used to cancel waiting on events:
        +
        +```js
        +const { on, EventEmitter } = require('events');
        +const ac = new AbortController();
        +
        +(async () => {
        +  const ee = new EventEmitter();
        +
        +  // Emit later on
        +  process.nextTick(() => {
        +    ee.emit('foo', 'bar');
        +    ee.emit('foo', 42);
        +  });
        +
        +  for await (const event of on(ee, 'foo', { signal: ac.signal })) {
        +    // 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
        +})();
        +
        +process.nextTick(() => ac.abort());
        +
        +
        +
        since
        +

        v13.6.0, v12.16.0

        +
        +
        +

        Parameters

        • @@ -2100,12 +2201,16 @@
        • eventName: string
          +
          +

          The name of the event being listened for

          +
        • Optional options: StaticEventEmitterOptions

        Returns AsyncIterableIterator<any>

        +

        that iterates eventName events emitted by the emitter

    @@ -2121,9 +2226,88 @@ +
    +
    +

    Creates a Promise that is fulfilled when the EventEmitter emits the given + event or that is rejected if the EventEmitter emits 'error' while waiting. + The Promise will resolve with an array of all the arguments emitted to the + given event.

    +
    +

    This method is intentionally generic and works with the web platformEventTarget interface, which has no special'error' event + semantics and does not listen to the 'error' event.

    +
    const { once, EventEmitter } = require('events');
    +
    +async function run() {
    +  const ee = new EventEmitter();
    +
    +  process.nextTick(() => {
    +    ee.emit('myevent', 42);
    +  });
    +
    +  const [value] = await once(ee, 'myevent');
    +  console.log(value);
    +
    +  const err = new Error('kaboom');
    +  process.nextTick(() => {
    +    ee.emit('error', err);
    +  });
    +
    +  try {
    +    await once(ee, 'myevent');
    +  } catch (err) {
    +    console.log('error happened', err);
    +  }
    +}
    +
    +run();
    +
    +

    The special handling of the 'error' event is only used when events.once()is used to wait for another event. If events.once() is used to wait for the + 'error' event itself, then it is treated as any other kind of event without + special handling:

    +
    const { EventEmitter, once } = require('events');
    +
    +const ee = new EventEmitter();
    +
    +once(ee, 'error')
    +  .then(([err]) => console.log('ok', err.message))
    +  .catch((err) => console.log('error', err.message));
    +
    +ee.emit('error', new Error('boom'));
    +
    +// Prints: ok boom
    +
    +

    An AbortSignal can be used to cancel waiting for the event:

    +
    const { EventEmitter, once } = require('events');
    +
    +const ee = new EventEmitter();
    +const ac = new AbortController();
    +
    +async function foo(emitter, event, signal) {
    +  try {
    +    await once(emitter, event, { signal });
    +    console.log('event emitted!');
    +  } catch (error) {
    +    if (error.name === 'AbortError') {
    +      console.error('Waiting for the event was canceled!');
    +    } else {
    +      console.error('There was an error', error.message);
    +    }
    +  }
    +}
    +
    +foo(ee, 'foo', ac.signal);
    +ac.abort(); // Abort waiting for the event
    +ee.emit('foo'); // Prints: Waiting for the event was canceled!
    +
    +
    +
    since
    +

    v11.13.0, v10.16.0

    +
    +
    +

    Parameters

    • @@ -2142,7 +2326,7 @@

      Parameters

      @@ -2371,7 +2555,7 @@ create
    • - getEventListener + getEventListeners
    • listenerCount diff --git a/index.html b/index.html index 12c47fc2..1442cda1 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,8 @@ - libp2p - v0.32.4 - + libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -50,7 +50,7 @@
    -

    libp2p - v0.32.4

    +

    libp2p - v0.31.8

    diff --git a/interfaces/constructoroptions.html b/interfaces/constructoroptions.html index 8aa17f23..4469527a 100644 --- a/interfaces/constructoroptions.html +++ b/interfaces/constructoroptions.html @@ -3,8 +3,8 @@ - constructorOptions | libp2p - v0.32.4 - + constructorOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
  • Preparing search index...
  • The search index is not available
  • - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • constructorOptions @@ -94,7 +94,7 @@
      peerId: PeerId
      diff --git a/interfaces/createoptions.html b/interfaces/createoptions.html index 2debdfe1..6f4ca6e6 100644 --- a/interfaces/createoptions.html +++ b/interfaces/createoptions.html @@ -3,8 +3,8 @@ - CreateOptions | libp2p - v0.32.4 - + CreateOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • CreateOptions @@ -94,7 +94,7 @@
      peerId: undefined | PeerId
      diff --git a/interfaces/dhtoptions.html b/interfaces/dhtoptions.html index d70f85b3..bdd29e93 100644 --- a/interfaces/dhtoptions.html +++ b/interfaces/dhtoptions.html @@ -3,8 +3,8 @@ - DhtOptions | libp2p - v0.32.4 - + DhtOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • HandlerProps @@ -96,7 +96,7 @@
      connection: Connection
      @@ -106,7 +106,7 @@
      protocol: string
      @@ -116,7 +116,7 @@
      stream: MuxedStream
      diff --git a/interfaces/keychainoptions.html b/interfaces/keychainoptions.html index 5f964cd0..918ea825 100644 --- a/interfaces/keychainoptions.html +++ b/interfaces/keychainoptions.html @@ -3,8 +3,8 @@ - KeychainOptions | libp2p - v0.32.4 - + KeychainOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • KeychainOptions @@ -94,7 +94,7 @@
      datastore: undefined | Datastore
      diff --git a/interfaces/libp2pconfig.html b/interfaces/libp2pconfig.html index eec7004e..afbaa7f6 100644 --- a/interfaces/libp2pconfig.html +++ b/interfaces/libp2pconfig.html @@ -3,8 +3,8 @@ - Libp2pConfig | libp2p - v0.32.4 - + Libp2pConfig | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • MetricsOptions @@ -94,7 +94,7 @@
      enabled: boolean
      diff --git a/interfaces/peerstoreoptions.html b/interfaces/peerstoreoptions.html index 9929fba9..e81ed5c6 100644 --- a/interfaces/peerstoreoptions.html +++ b/interfaces/peerstoreoptions.html @@ -3,8 +3,8 @@ - PeerStoreOptions | libp2p - v0.32.4 - + PeerStoreOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • PeerStoreOptions @@ -94,7 +94,7 @@
      persistence: boolean
      diff --git a/interfaces/pubsublocaloptions.html b/interfaces/pubsublocaloptions.html index cbe50103..0cc6e04a 100644 --- a/interfaces/pubsublocaloptions.html +++ b/interfaces/pubsublocaloptions.html @@ -3,8 +3,8 @@ - PubsubLocalOptions | libp2p - v0.32.4 - + PubsubLocalOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    • - libp2p - v0.32.4 + libp2p - v0.31.8
    • PubsubLocalOptions @@ -94,7 +94,7 @@
      enabled: boolean
      diff --git a/interfaces/randomwalkoptions.html b/interfaces/randomwalkoptions.html index 9d062556..1e03cd52 100644 --- a/interfaces/randomwalkoptions.html +++ b/interfaces/randomwalkoptions.html @@ -3,8 +3,8 @@ - RandomWalkOptions | libp2p - v0.32.4 - + RandomWalkOptions | libp2p - v0.31.8 + @@ -23,7 +23,7 @@
    • Preparing search index...
    • The search index is not available
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -52,7 +52,7 @@
    - libp2p - v0.32.4 + libp2p - v0.31.8
    @@ -50,7 +50,7 @@
    -

    libp2p - v0.32.4

    +

    libp2p - v0.31.8

    @@ -113,7 +113,7 @@
    Connection: Connection
    @@ -123,7 +123,7 @@
    ContentRoutingModule: ContentRouting
    @@ -133,7 +133,7 @@
    Crypto: Crypto
    @@ -143,7 +143,7 @@
    Datastore: Datastore
    @@ -153,7 +153,7 @@
    MuxedStream: MuxedStream
    @@ -163,7 +163,7 @@
    MuxerFactory: MuxerFactory
    @@ -173,7 +173,7 @@
    PeerDiscoveryFactory: PeerDiscoveryFactory
    @@ -183,7 +183,7 @@
    PeerRoutingModule: PeerRouting
    @@ -193,7 +193,7 @@
    Protector: __module
    @@ -203,7 +203,7 @@
    Pubsub: __module
    @@ -213,7 +213,7 @@
    PubsubOptions: PubsubOptions
    @@ -223,7 +223,7 @@
    TransportFactory: TransportFactory