export interface IHandle { destroy(this: IHandle): void; } /** * Returns an object with a destroy method that, when called, calls the passed-in destructor. * This is intended to provide a unified interface for creating "remove" / "destroy" handlers for * event listeners, timers, etc. * * @param destructor A function that will be called when the handle's `destroy` method is invoked * @return The handle object */ export declare function createHandle(destructor: () => void): IHandle; /** * Returns a single handle that can be used to destroy multiple handles simultaneously. * * @param handles An array of handles with `destroy` methods * @return The handle object */ export declare function createCompositeHandle(...handles: IHandle[]): IHandle; /** * Provides a normalized mechanism for dispatching events for event emitters, * Evented objects, or DOM nodes. * @param {(Window | Document | Node)} target The target to emit the event from * @param {string} type The event type to emit * @returns Boolean indicating if preventDefault was called on the event object (only relevant for DOM events; */ export declare function emit(target: Window | Document | Node, type: string, bubbles: boolean, cancelable: boolean, params?: { [key: string]: any; }): boolean; /** * Provides a normalized mechanism for listening to events from event emitters, Evented objects, or DOM nodes. * @param target Target to listen for event on * @param type Event event type(s) to listen for; may a string or an array of strings * @param listener Callback to handle the event when it fires * @param capture Whether the listener should be registered in the capture phase (DOM events only) * @return A handle which will remove the listener when destroy is called */ export default function on(target: Window | Document | Node, type: string | string[], listener: EventListener, capture?: boolean): IHandle; /** * Provides a mechanism for listening to the next occurrence of an event from event * emitters, Evented objects, or DOM nodes. * @param target Target to listen for event on * @param type Event event type(s) to listen for; may be a string or an array of strings * @param listener Callback to handle the event when it fires * @param capture Whether the listener should be registered in the capture phase (DOM events only) * @return A handle which will remove the listener when destroy is called */ export declare function once(target: Window | Document | Node, type: string | string[], listener: EventListener, capture?: boolean): IHandle; export interface IPausableHandle extends IHandle { pause(): void; resume(): void; } /** * Provides a mechanism for creating pausable listeners for events from event emitters, Evented objects, or DOM nodes. * @param target Target to listen for event on * @param type Event event type(s) to listen for; may a string or an array of strings * @param listener Callback to handle the event when it fires * @param capture Whether the listener should be registered in the capture phase (DOM events only) * @return A handle with additional pause and resume methods; the listener will never fire when paused */ export declare function pausable(target: Window | Document | Node, type: string | string[], listener: EventListener, capture?: boolean): IPausableHandle;