peerix - v0.1.0
    Preparing search index...

    Class Addon

    Base class for Peerix addons.

    Addons are modular extensions that can be attached to a Peer instance to provide additional functionality or integrate with external services.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Attaches the addon to a Peer instance. This method is called when the addon is added to a peer using peer.attach(addon).

      Parameters

      • peer: Peer

        The Peer instance to attach to.

      Returns Promise<void>

    • Detaches the addon from a Peer instance. This method is called when the addon is removed from a peer using peer.detach(addon).

      Parameters

      • peer: Peer

        The Peer instance to detach from.

      Returns Promise<void>

    • Emits one or more events from the addon.

      Parameters

      • event: string

        Event name or list of event names.

      • ...args: any[]

        Arguments to pass to the event handlers.

      Returns void

    • Unsubscribes from one or more events emitted by the addon.

      Parameters

      • event: string

        Event name or list of event names.

      • Optionalhandler: (...args: any[]) => void

        Optional event handler to remove. If not provided, all handlers for the event(s) will be removed.

      Returns void

    • Subscribes to one or more events emitted by the addon.

      Parameters

      • event: string

        Event name or list of event names.

      • handler: (...args: any[]) => void

        Event handler.

      Returns void

    • Subscribes to one or more events emitted by the addon for a single invocation.

      Parameters

      • event: string

        Event name or list of event names.

      • handler: (...args: any[]) => void

        Event handler.

      Returns void