import { EventDispatcherBase, Subscribable } from './EventDispatcherBase'; export interface AsyncEventHandler { (value: T): Promise; } /** * Dispatches an asynchronous {@link SubscribableEvent}. * * @remarks * The {@link dispatch} method returns a promise that resolves when all the * handlers resolve. * * @example * ```ts * class Example { * // expose the event to external classes * public get onValueChanged { * return this.value.subscribable; * } * // create a private dispatcher * private value = new AsyncEventDispatcher(); * * private async dispatchExample() { * // dispatching returns a Promise. * await this.value.dispatch(0); * } * } * ``` * * @typeParam T - The type of the argument passed to subscribers. */ export declare class AsyncEventDispatcher extends EventDispatcherBase> { dispatch(value: T): Promise; } /** * Provides safe access to the public interface of {@link AsyncEventDispatcher}. * * @remarks * External classes can use it to subscribe to an event without being able to * dispatch it. * * @typeParam T - The type of the argument passed to subscribers. */ export type SubscribableAsyncEvent = Subscribable>; //# sourceMappingURL=AsyncEventDispatcher.d.ts.map