import type { IEvent } from './IEvent'; import type { IEventHandler } from './IEventHandler'; /** * A base implementation of an event. To avoid misuse, declare a private event of this type and expose it as an {@linkcode IEvent}. * @template TSubject Optional, the type of object that raises the event. * @template TEventArgs Optional, the type of the event context containing additional information about the event. */ export declare class EventDispatcher implements IEvent { private _eventHandlers; /** Initializes a new instance of the {@linkcode EventDispatcher} class. */ constructor(); /** * Subscribes the given eventHandler to the event. * @param eventHandler An event handler that gets notified when the event is raised. */ subscribe>(eventHandler: TEventHandler): void; /** * Unsubscribes the given eventHandler to the event. The exact same object that was used to subscribe to the event must be passed as well. * @param eventHandler The event handler that was previously subscribed to the event. */ unsubscribe>(eventHandler: TEventHandler): void; /** * Dispatches a notification to all subscribers. * @param subject The object raising the event, generally the object which is exposing it. * @param args A set of arguments that provide context for the event. */ dispatch(subject: TSubject, args: TEventArgs): void; }