export declare type EventType = string | symbol; export declare type Handler = (event: T) => void; export declare type WildcardHandler> = (type: keyof T, event: T[keyof T]) => void; export declare type EventHandlerList = Array>; export declare type WildCardEventHandlerList> = Array>; export declare type EventHandlerMap> = Map | WildCardEventHandlerList>; export interface Emitter> { all: EventHandlerMap; on(type: Key, handler: Handler): void; on(type: '*', handler: WildcardHandler): void; off(type: Key, handler?: Handler): void; off(type: '*', handler: WildcardHandler): void; emit(type: Key, event: Events[Key]): void; emit(type: undefined extends Events[Key] ? Key : never): void; } declare type Events = Record; declare class EventManager implements Emitter> { all: Map; /** * Register an event handler for the given type. * @param {string|symbol} type Type of event to listen for, or `'*'` for all events * @param {Function} handler Function to call in response to given event * @memberOf EventManager */ on(type: Key, handler: Function): void; /** * Remove an event handler for the given type. * If `handler` is omitted, all handlers of the given type are removed. * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'` * @param {Function} [handler] Handler function to remove * @memberOf EventManager */ off(type: Key, handler?: Function): void; /** * Invoke all handlers for the given type. * If present, `'*'` handlers are invoked after type-matched handlers. * * Note: Manually firing '*' handlers is not supported. * * @param {string|symbol} type The event type to invoke * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler * @memberOf EventManager */ emit(type: Key, evt?: Events[Key]): void; } export default EventManager;