Interface EventSource<Context, Data>

Interfaces for event source objects. Interested parties can subscribe to the event and are notified when the event occurs.

Type parameters

  • Context

  • Data

Hierarchy

  • EventSource

Index

Properties

off

off: function

Removes the given listener that was previously added via on or one. Note that the context must be the same as the context that was passed to on or one.

param

Listener to remove.

param

Optional context to limit the scope of the listener.

Type declaration

    • Parameters

      Returns void

on

on: function

Register the given listener with the event source. When the event occurs, the given listener is invoked. You can specify an optional context parameter to restrict the scope of the listener.

Uncaught errors in the listener are caught and logged, but not propagated. Note that registering the same listener with the same context twice has no effect.

param

Listener to register.

param

Optional context to limit the scope of the listener.

Type declaration

    • Parameters

      Returns void

one

one: function

Register the given listener with the event source. When the event occurs the next time, the given listener is invoked once, then removed. You can specify an optional context parameter to restrict the scope of the listener.

Uncaught errors in the listener are caught and logged, but not propagated. Note that registering the same listener with the same context twice has no effect.

param

Listener to register.

param

Optional context to limit the scope of the listener.

Type declaration

    • Parameters

      Returns void

removeAll

removeAll: function

Removes all event subscriptions for this event source.

Type declaration

    • (): void
    • Returns void

removeAllByContext

removeAllByContext: function

Removes all event subscriptions with the given context, irrespective of the listener.

param

Context of the subscriptions to remove.

Type declaration

    • (context: Context): void
    • Parameters

      • context: Context

      Returns void

removeAllByListener

removeAllByListener: function

Removes all event subscriptions with the given listener, irrespective of the context.

param

Listener of the subscriptions to remove.

Type declaration