Skip to content

EventDispatcher

github-actions[bot] edited this page Dec 3, 2024 · 3 revisions
API / EventDispatcher<TSubject, TEventArgs> class

A base implementation of an event. To avoid misuse, declare a private event of this type and expose it as an IEvent<TSubject, TEventArgs>.

Implements IEvent<TSubject, TEventArgs>.

class EventDispatcher<TSubject, TEventArgs = void>
    implements IEvent<TSubject, TEventArgs>

Source reference: src/events/EventDispatcher.ts:9.

Generic Parameters

  • TSubject - Optional, the type of object that raises the event.

  • TEventArgs - Optional, the type of the event context containing additional information about the event.

    Default value: void.

Constructors

Methods

  • dispatch - Dispatches a notification to all subscribers.
  • subscribe - Subscribes the given eventHandler to the event.
  • unsubscribe - Unsubscribes the given eventHandler to the event. The exact same object that was used to subscribe to the event must be passed as well.

Inheritance Hierarchy

  • EventDispatcher<TSubject, TEventArgs>
Clone this wiki locally