UNPKG

ste-promise-events

Version:

Add the power of Events to your projects. They are styled after .Net using a sender and arguments. Handlers can be promises.

24 lines (23 loc) 797 B
import { PromiseEventDispatcher } from "./PromiseEventDispatcher"; /** * Similar to EventList, but instead of TArgs, a map of event names ang argument types is provided with TArgsMap. */ export declare class NonUniformPromiseEventList<TSender, 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): PromiseEventDispatcher<TSender, 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>(): PromiseEventDispatcher<TSender, T>; }