Documentation
    Preparing search index...

    Class EventEmitter<Events>Abstract

    Simple event emitter class that allows adding event listeners and emitting events.

    Type Parameters

    • Events extends Record<EventType, unknown> = never

      A type representing the events that the instance can emit and listen to.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    emitter: Emitter<Events> = ...

    An event emitter for handling custom events.

    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 { remove: () => void }

      An object with a remove method to unsubscribe the listener.