Class JDEventSource

Base class for evented nodes in Jacdac

Hierarchy

Implements

JDOM

eventStats: Record<string, number> = {}

Gets a counter of event emit calls.

newListenerStats: Record<string, number> = undefined

Gets a counter map from events to new listener counts

nodeId: number = ...

Gets an internal unique node identifier, mostly used for debugging.

  • Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.

    Parameters

    • eventName: string
    • Rest ...args: unknown[]

    Returns boolean

  • Returns an array listing the events for which the emitter has registered listeners.

    Returns string[]

  • Gets the number of listeners for a given event

    Parameters

    • eventName: string

      name of the event

    Returns number

    number of registered handlers

  • Gets the list stack trace where an event was registered. Only enabled if Flags.debug is true.

    Parameters

    • eventName: string

      name of the event

    Returns string[]

    stack traces where a listener was added

  • Creates an observable from the given event

    Type Parameters

    • T

    Parameters

    • eventName: string | string[]

    Returns Observable<T>

  • Subscribes to an event and returns the unsubscription handler

    Type Parameters

    • T

    Parameters

    • eventName: string | string[]
    • next: ((value) => void)
        • (value): void
        • Parameters

          • value: T

          Returns void

    Returns (() => void)

      • (): void
      • Subscribes to an event and returns the unsubscription handler

        Returns void

        Category

        JDOM

Other

  • Awaits an event with a timeout. Throws JacdacError with timeout if operation does not return.

    Parameters

    Returns Promise<void>

Generated using TypeDoc