Class SimpleEventDispatcher<T>

A simple event dispatcher with typed event types, see IEventDispatcher.

Type Parameters

  • T extends string

Hierarchy

Implements

Constructors

Properties

_eventListeners: Record<string, ((event) => void)[]> = {}

Methods

  • Adds a listener to an event type.

    Parameters

    • type: T

      The type of event to listen to.

    • listener: ((event) => void)

      The function that gets called when the event is fired.

        • (event): void
        • Parameters

          Returns void

    Returns void

  • Checks if listener is added to an event type.

    Parameters

    • type: T

      The type of event to listen to.

    • listener: ((event) => void)

      The function that gets called when the event is fired.

        • (event): void
        • Parameters

          Returns void

    Returns boolean

  • Removes a listener from an event type.

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: ((event) => void)

      The listener function that gets removed.

        • (event): void
        • Parameters

          Returns void

    Returns void

Generated using TypeDoc