libp2p
    Preparing search index...

    Interface PeerDiscovery

    A class that implements the PeerDiscovery interface uses an implementation-specific method to discover peers. These peers are then added to the peer store for use by other system components and services.

    interface PeerDiscovery {
        addEventListener<K extends "peer">(
            type: K,
            listener: EventHandler<PeerDiscoveryEvents[K]> | null,
            options?: boolean | AddEventListenerOptions,
        ): void;
        dispatchEvent(event: Event): boolean;
        dispatchEvent(event: Event): boolean;
        listenerCount(type: string): number;
        removeEventListener<K extends "peer">(
            type: K,
            listener?: EventHandler<PeerDiscoveryEvents[K]> | null,
            options?: boolean | EventListenerOptions,
        ): void;
        removeEventListener(
            type: string,
            listener?: EventHandler<Event>,
            options?: boolean | EventListenerOptions,
        ): void;
        safeDispatchEvent<Detail>(
            type: "peer",
            detail?: CustomEventInit<Detail>,
        ): boolean;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Type Parameters

      • K extends "peer"

      Parameters

      Returns void

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • Parameters

      • type: string

      Returns number

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Type Parameters

      • K extends "peer"

      Parameters

      Returns void

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

      MDN Reference

      Parameters

      • type: string
      • Optionallistener: EventHandler<Event>
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Type Parameters

      • Detail

      Parameters

      • type: "peer"
      • Optionaldetail: CustomEventInit<Detail>

      Returns boolean