An object that may dispatch one type of event and have handlers for that event.

Type Parameters

  • T

Implements

Constructors

Accessors

Methods

Constructors

Accessors

  • get empty(): boolean
  • Returns true if this signal has no handlers.

    Returns boolean

Methods

  • Removes all handlers.

    Returns void

  • Invokes all handlers, providing the given event.

    Handlers may add/remove callbacks or do a nested dispatch.

    If a handler is added within a handler, the new handler will not be invoked until the next dispatch.

    Parameters

    • event: T

    Returns void

  • Same as clear.

    Returns void

  • Adds an event handler that will be invoked upon signal dispatch.

    Parameters

    • handler: EventHandler<T>

      The handler to invoke on signal dispatch.

    • Optionaloptions: SignalOptions

      Options for changing listening behavior.

    Returns Unsubscribe

    Unsubscribe - Returns a method where, when invoked, will remove the handler. If the handler has already been removed, Unsubscribe will do nothing.