Class EventEmitter

Class-based EventEmitter for managing custom events with pInstance-specific tracking.

Constructors

Properties

Methods

Constructors

Properties

events: WeakMap<object, Map<string, Set<Function>>>

Map to store event listeners by pInstance and event type.

Methods

  • Registers a listener for a specified event on a specific pInstance.

    Parameters

    • pInstance: object

      The instance to associate the event with.

    • pEventName: string

      The name of the event.

    • pListener: Function

      The function to invoke when the event is triggered.

    Returns void

  • Unregisters a listener for a specified event on a specific pInstance.

    Parameters

    • pInstance: object

      The instance to disassociate the event from.

    • pEventName: string

      The name of the event.

    • pListener: Function

      The function to remove from the event.

    Returns void

  • Triggers a specified event on a specific pInstance, invoking all registered listeners.

    Parameters

    • pInstance: object

      The instance to trigger the event on.

    • pEventName: string

      The name of the event.

    • Optional pData: any

      The data to pass to the event listeners.

    Returns void