For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Class Evented<EventType>Abstract

Methods mixed in to other classes for event capabilities.

Type Parameters

Hierarchy (View Summary)

Index

Constructors

Methods

  • Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.

    Parameters

    Returns boolean

    true if there is at least one registered listener for specified event type, false otherwise

  • Removes a previously registered event listener.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The event type to remove listeners for.

    • listener: (event: EventType[T]) => void

      The listener function to remove.

    Returns this

  • Adds a listener to a specified event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The event type to add a listen for.

    • listener: (event: EventType[T]) => void

      The function to be called when the event is fired. The listener function is called with the data object passed to fire, extended with target and type properties.

    Returns Subscription

  • Adds a listener that will be called only once to a specified event type.

    The listener will be called first time the event fires after the listener is registered.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The event type to listen for.

    Returns Promise<EventType[T]>

    a promise that resolves with the event

  • Adds a listener that will be called only once to a specified event type.

    The listener will be called first time the event fires after the listener is registered.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The event type to listen for.

    • listener: (event: EventType[T]) => void

      The function to be called when the event is fired the first time.

    Returns this

    this when a listener is provided

Was this helpful?