UNPKG

ste-promise-simple-events

Version:

Add the power of Simple Events to your projects. Every event has an argument with its data. Every handler can be a promise.

24 lines (23 loc) 800 B
import { PromiseSimpleEventDispatcher } from "./PromiseSimpleEventDispatcher"; /** * Similar to EventList, but instead of TArgs, a map of event names ang argument types is provided with TArgsMap. */ export declare class NonUniformPromiseSimpleEventList<TArgsMap extends { [event: string]: any; }> { private _events; /** * Gets the dispatcher associated with the name. * @param name The name of the event. */ get<K extends keyof TArgsMap>(name: K): PromiseSimpleEventDispatcher<TArgsMap[K]>; /** * Removes the dispatcher associated with the name. * @param name The name of the event. */ remove(name: string): void; /** * Creates a new dispatcher instance. */ protected createDispatcher<T>(): PromiseSimpleEventDispatcher<T>; }