diff --git a/index.html b/index.html index 165aafd0..2dc3cc60 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - libp2p 0.27.6 | Documentation + libp2p 0.27.7 | Documentation @@ -15,7 +15,7 @@

libp2p

-
0.27.6
+
0.27.7
+
  • + globalThis + + + +
  • + + +
  • + SummaryObject + + + +
  • + + +
  • + LatencyMonitor + + + + + +
  • + + +
  • + + + + +
  • + + +
  • + VisibilityChangeEmitter + + + +
  • + + +
  • + isVisible + + + +
  • + +
  • @@ -1268,7 +1346,7 @@ - + src/index.js @@ -1337,7 +1415,7 @@
    - + src/index.js @@ -1427,7 +1505,7 @@ instance if one is not provided in options.

    - + src/index.js @@ -1515,7 +1593,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -1581,7 +1659,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -1647,7 +1725,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -1714,7 +1792,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -1827,7 +1905,7 @@ peer will be added to the nodes peerStore

    - + src/index.js @@ -1949,7 +2027,7 @@ and the Connection will be sent in the callback

    - + src/index.js @@ -2029,7 +2107,7 @@ and the Connection will be sent in the callback

    - + src/index.js @@ -2109,7 +2187,7 @@ and the Connection will be sent in the callback

    - + src/index.js @@ -2188,7 +2266,7 @@ and the Connection will be sent in the callback

    - + src/index.js @@ -2268,7 +2346,7 @@ will no longer be supported on streams.

    - + src/peer-routing.js @@ -2377,7 +2455,7 @@ will no longer be supported on streams.

    - + src/content-routing.js @@ -2496,7 +2574,7 @@ Once a content router succeeds, iteration will stop.

    - + src/content-routing.js @@ -2573,7 +2651,7 @@ a provider of the given key.

    - + src/content-routing.js @@ -2690,7 +2768,7 @@ a provider of the given key.

    - + src/content-routing.js @@ -2800,7 +2878,7 @@ Times out after 1 minute by default.

    - + src/content-routing.js @@ -2917,7 +2995,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3001,7 +3079,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3077,7 +3155,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3160,7 +3238,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3222,7 +3300,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3297,7 +3375,7 @@ Times out after 1 minute by default.

    - + src/get-peer-info.js @@ -3382,7 +3460,7 @@ the peer will be updated in the PeerStore.

    - + src/get-peer-info.js @@ -3466,7 +3544,7 @@ the libp2p PeerRouter will be used to attempt to find the peer.

    - + src/connection-manager/index.js @@ -3637,7 +3715,7 @@ the libp2p PeerRouter will be used to attempt to find the peer.

    - + src/connection-manager/index.js @@ -3692,7 +3770,7 @@ only event loop and connection limits will be monitored.

    - + src/connection-manager/index.js @@ -3746,7 +3824,7 @@ only event loop and connection limits will be monitored.

    - + src/connection-manager/index.js @@ -3823,7 +3901,7 @@ will be disconnected first.

    - + src/connection-manager/index.js @@ -3890,7 +3968,7 @@ will be disconnected first.

    - + src/connection-manager/index.js @@ -3942,6 +4020,599 @@ will be disconnected first.

    + + + + + +
    + + + + + +

    This code is based on latency-monitor (https://github.com/mlucool/latency-monitor) by mlucool (https://github.com/mlucool), available under Apache License 2.0 (https://github.com/mlucool/latency-monitor/blob/master/LICENSE)

    + +
    globalThis
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + +
    + +

    + SummaryObject +

    + + + + src/connection-manager/latency-monitor.js + + +
    + + + +
    SummaryObject
    + +

    + Type: + Object +

    + + + + + + + + + + + + + +
    Properties
    +
    + +
    + events (Number) + : How many events were called + + +
    + +
    + minMS (Number) + : What was the min time for a cb to be called + + +
    + +
    + maxMS (Number) + : What was the max time for a cb to be called + + +
    + +
    + avgMs (Number) + : What was the average time for a cb to be called + + +
    + +
    + lengthMs (Number) + : How long this interval was in ms + + +
    + +
    + + + + + + + + + + + + + + + + + +
    + + + + +
    + + +
    + +

    + LatencyMonitor +

    + + + + src/connection-manager/latency-monitor.js + + +
    + + +

    A class to monitor latency of any async function which works in a browser or node. This works by periodically calling +the asyncTestFn and timing how long it takes the callback to be called. It can also periodically emit stats about this. +This can be disabled and stats can be pulled via setting dataEmitIntervalMs = 0.

    +

    The default implementation is an event loop latency monitor. This works by firing periodic events into the event loop +and timing how long it takes to get back.

    + +
    new LatencyMonitor($0: Object, latencyCheckIntervalMs: Number, dataEmitIntervalMs: Number, asyncTestFn: function?, latencyRandomPercentage: Number)
    + + +

    + Extends + + EventEmitter + +

    + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + $0 (Object + = {}) + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    $0.latencyCheckIntervalMs any +
    $0.dataEmitIntervalMs any +
    $0.asyncTestFn any +
    $0.latencyRandomPercentage any +
    + +
    + +
    +
    + latencyCheckIntervalMs (Number + = 500) + How often to add a latency check event (ms) + +
    + +
    + +
    +
    + dataEmitIntervalMs (Number + = 5000) + How often to summarize latency check events. null or 0 disables event firing + +
    + +
    + +
    +
    + asyncTestFn (function?) + What cb-style async function to use + +
    + +
    + +
    +
    + latencyRandomPercentage (Number + = 5) + What percent (+/-) of latencyCheckIntervalMs should we randomly use? This helps avoid alignment to other events. + +
    + +
    + +
    + + + + + + + + + + + +
    Example
    + + +
    const monitor = new LatencyMonitor();
    +monitor.on('data', (summary) => console.log('Event Loop Latency: %O', summary));
    + + +
    const monitor = new LatencyMonitor({latencyCheckIntervalMs: 1000, dataEmitIntervalMs: 60000, asyncTestFn:ping});
    +monitor.on('data', (summary) => console.log('Ping Pong Latency: %O', summary));
    + + + + + + +
    Instance Members
    +
    + +
    +
    +
    + + getSummary() +
    +
    + +
    + +
    + + + + + + +
    + + + + +
    + + + + + +

    This code is based on latency-monitor (https://github.com/mlucool/latency-monitor) by mlucool (https://github.com/mlucool), available under Apache License 2.0 (https://github.com/mlucool/latency-monitor/blob/master/LICENSE)

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + +
    + +

    + VisibilityChangeEmitter +

    + + + + src/connection-manager/visibility-change-emitter.js + + +
    + + +

    Listen to page visibility change events (i.e. when the page is focused / blurred) by an event emitter.

    +

    Warning: This does not work on all browsers, but should work on all modern browsers

    + +
    new VisibilityChangeEmitter()
    + + + + + + + + + + + + + + + + + + + + + +
    Example
    + + +
    const myVisibilityEmitter = new VisibilityChangeEmitter();
    +
    +    myVisibilityEmitter.on('visibilityChange', (pageInFocus) => {
    +       if ( pageInFocus ){
    +           // Page is in focus
    +           console.log('In focus');
    +       }
    +       else {
    +           // Page is blurred
    +           console.log('Out of focus');
    +       }
    +    });
    +    // To access the visibility state directly, call:
    +    console.log('Am I focused now? ' + myVisibilityEmitter.isVisible());
    + + + + + + + + + + +
    + + + + +
    + + + + + +

    The function returns true if the page is visible or false if the page is not visible and +undefined if the page visibility API is not supported by the browser.

    + +
    isVisible(): (Boolean | void)
    + + + + + + + + + + + + + + + + +
    Returns
    + (Boolean | void): + whether the page is now visible or not (undefined is unknown) + + + + + + + + + + + + + + + + + +
    @@ -3957,7 +4628,7 @@ will be disconnected first.

    - + src/circuit/index.js @@ -4056,7 +4727,7 @@ will be disconnected first.

    - + src/circuit/index.js @@ -4166,7 +4837,7 @@ will be disconnected first.

    - + src/circuit/index.js @@ -4249,7 +4920,7 @@ will be disconnected first.

    - + src/circuit/index.js @@ -4324,7 +4995,7 @@ will be disconnected first.

    - + src/circuit/index.js @@ -4378,7 +5049,7 @@ will be disconnected first.

    - + src/identify/index.js @@ -4446,7 +5117,7 @@ will be disconnected first.

    - + src/circuit/listener.js @@ -4516,7 +5187,7 @@ will be disconnected first.

    - + src/circuit/listener.js @@ -4595,7 +5266,7 @@ will be disconnected first.

    - + src/circuit/listener.js @@ -4661,7 +5332,7 @@ will be disconnected first.

    - + src/circuit/listener.js @@ -4746,7 +5417,7 @@ be dialed over TCP rather than any other transport

    - + src/circuit/circuit/hop.js @@ -4863,7 +5534,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/utils.js @@ -4938,7 +5609,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/utils.js @@ -5014,7 +5685,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -5117,7 +5788,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -5179,7 +5850,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -5247,7 +5918,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -5309,7 +5980,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -5371,7 +6042,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js @@ -5559,7 +6230,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js @@ -5613,7 +6284,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js @@ -5725,7 +6396,7 @@ will be used.

    - + src/dialer/index.js @@ -5808,7 +6479,7 @@ will be used.

    - + src/dialer/index.js @@ -5911,7 +6582,7 @@ will be used.

    - + src/dialer/index.js @@ -5986,7 +6657,7 @@ will be used.

    - + src/dialer/dial-request.js @@ -6097,7 +6768,7 @@ all other dials in the request will be cancelled.

    - + src/dialer/dial-request.js @@ -6196,7 +6867,7 @@ all other dials in the request will be cancelled.

    - + src/metrics/index.js @@ -6310,7 +6981,7 @@ all other dials in the request will be cancelled.

    - + src/metrics/index.js @@ -6365,7 +7036,7 @@ will be ignored.

    - + src/metrics/index.js @@ -6420,7 +7091,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -6482,7 +7153,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -6544,7 +7215,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -6620,7 +7291,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -6682,7 +7353,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -6757,7 +7428,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -6826,7 +7497,7 @@ be stopped and moved to an LRU for temporary retention.

    - + src/metrics/index.js @@ -6904,7 +7575,7 @@ placeholder stats will be merged with the existing stats.

    - + src/metrics/index.js @@ -7034,7 +7705,7 @@ with the placeholder string returned from here, and the known PeerId - + src/metrics/index.js @@ -7118,7 +7789,7 @@ and returned.

    - + src/metrics/old-peers.js @@ -7193,7 +7864,7 @@ and returned.

    - + src/metrics/stats.js @@ -7273,7 +7944,7 @@ and returned.

    - + src/metrics/stats.js @@ -7341,7 +8012,7 @@ should only need to be called if Stats.stop was previously called,
    - + src/metrics/stats.js @@ -7408,7 +8079,7 @@ timer.

    - + src/metrics/stats.js @@ -7474,7 +8145,7 @@ timer.

    - + src/metrics/stats.js @@ -7540,7 +8211,7 @@ timer.

    - + src/metrics/stats.js @@ -7606,7 +8277,7 @@ timer.

    - + src/metrics/stats.js @@ -7702,7 +8373,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -7802,7 +8473,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -7895,7 +8566,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -7949,7 +8620,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8032,7 +8703,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8094,7 +8765,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8156,7 +8827,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8231,7 +8902,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8298,7 +8969,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -8366,7 +9037,7 @@ If a transport has any running listeners, they will be closed.

    - + src/transport-manager.js @@ -8421,7 +9092,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -8582,7 +9253,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -8661,7 +9332,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -8748,7 +9419,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -8912,7 +9583,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -8991,7 +9662,7 @@ If any listeners are running, they will be closed.

    - + src/upgrader.js @@ -9078,7 +9749,7 @@ If any listeners are running, they will be closed.

    - + src/peer-store/index.js @@ -9137,7 +9808,7 @@ If any listeners are running, they will be closed.

    - + src/peer-store/index.js @@ -9200,7 +9871,7 @@ If any listeners are running, they will be closed.

    - + src/peer-store/index.js @@ -9317,7 +9988,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9396,7 +10067,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9475,7 +10146,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9555,7 +10226,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9635,7 +10306,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9715,7 +10386,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9794,7 +10465,7 @@ known, but may not have been added to the PeerStore yet.

    - + src/peer-store/index.js @@ -9882,7 +10553,7 @@ will include the encapsulated PeerId of the peer.

    - + src/registrar.js @@ -9979,7 +10650,7 @@ will include the encapsulated PeerId of the peer.

    - + src/registrar.js @@ -10043,7 +10714,7 @@ TODO: this should be handled by connectionManager

    - + src/registrar.js @@ -10106,7 +10777,7 @@ TODO: this should be handled by connectionManager

    - + src/registrar.js @@ -10164,7 +10835,7 @@ TODO: this should be handled by connectionManager

    - + src/registrar.js @@ -10252,7 +10923,7 @@ TODO: this should live in the ConnectionManager

    - + src/registrar.js @@ -10348,7 +11019,7 @@ TODO: this should live in the ConnectionManager

    - + src/registrar.js @@ -10427,7 +11098,7 @@ TODO: this should live in the ConnectionManager

    - + src/registrar.js @@ -10507,7 +11178,7 @@ TODO: this should live in the ConnectionManager

    - + src/registrar.js @@ -10595,7 +11266,7 @@ TODO: this should live in the ConnectionManager

    - + src/ping/index.js @@ -10678,7 +11349,7 @@ TODO: this should live in the ConnectionManager

    - + src/ping/index.js @@ -10745,7 +11416,7 @@ TODO: this should live in the ConnectionManager

    - + src/ping/index.js @@ -10812,7 +11483,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -10920,7 +11591,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -10973,7 +11644,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -11026,7 +11697,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -11101,7 +11772,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -11168,7 +11839,7 @@ TODO: this should live in the ConnectionManager

    - + src/identify/index.js @@ -11245,7 +11916,7 @@ an error will be thrown.

    - + src/identify/index.js @@ -11360,7 +12031,7 @@ an error will be thrown.

    - + src/identify/index.js @@ -11436,7 +12107,7 @@ with the provided multiaddrs

    - + src/identify/index.js @@ -11512,7 +12183,7 @@ with the provided protocols

    - + src/identify/index.js