Documentation
    Preparing search index...

    Interface EventEmitter<Events>

    An interface for an object on which you can listen to events.

    interface EventEmitter<Events extends Record<EventType, unknown> = never> {
        addEventListener<K extends string | number | symbol>(
            event: K,
            listener: (eventData: Events[K]) => void,
        ): EventHandle;
    }

    Type Parameters

    • Events extends Record<EventType, unknown> = never

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Adds an event listener for a specific event.

      Type Parameters

      • K extends string | number | symbol

        The type of the event key.

      Parameters

      • event: K

        The event to listen to.

      • listener: (eventData: Events[K]) => void

        The callback function to be invoked when the event is emitted.

      Returns EventHandle

      An EventHandle with a remove method to unsubscribe the listener.