import { Event, EventListener, EventMap, EventSupport } from '../index'; export declare class EventEmitter { events: EventSupport; eventMap: EventMap; self: EventEmitter; constructor(); protected _createEventSupport(): EventSupport; trigger>(type: K, eventOrModel?: Event | EventModel[K]>): EventMapOf[K]; /** * Registers the given event handler for the event specified by the type param. * The function will only be called once. After that it is automatically de-registered using {@link off}. * * @param type One or more event names separated by space. * @param handler Event handler executed when the event is triggered. An event object is passed to the function as first parameter */ one>(type: K, handler: EventHandler[K] & Event>): void; /** * Registers the given event handler for the event specified by the type param. * * @param type One or more event names separated by space. * @param handler Event handler executed when the event is triggered. An event object is passed to the function as first parameter. **/ on>(type: K, handler: EventHandler[K] & Event>): EventListener; /** * De-registers the given event handler for the event specified by the type param. * * @param type One or more event names separated by space.
* Important: the string must be equal to the one used for {@link on} or {@link one}. This also applies if a string containing multiple types separated by space was used. * @param handler The exact same event handler that was used for registration using {@link on} or {@link one}. * If no handler is specified, all handlers are de-registered for the given type. */ off>(type: K, handler?: EventHandler[K] & Event>): void; /** * Adds an event handler using {@link one} and returns a promise. * The promise is resolved as soon as the event is triggered. */ when>(type: K): JQuery.Promise[K] & Event>; addListener(listener: EventListener): void; removeListener(listener: EventListener): void; } export interface EventHandler { (event: K): void; } export type EventMapOf = T extends { eventMap: infer TMap; } ? TMap : object; /** Omits all properties that cannot be passed as part of the event model when the event is triggered. */ export type EventModel = Omit; //# sourceMappingURL=EventEmitter.d.ts.map