import type { VoidFunction } from './shared/types'; declare type WhenFunction = (e: Event) => boolean; export interface OnceEventListenerOptions extends AddEventListenerOptions { /** A function that returns a boolean to determine when the event should trigger */ when?: WhenFunction; } /** * Bind a single fire event handler for one or more event names on a DOM element. * (Add `when` to the options to conditional trigger the event) * * @param elm - DOM element to bind the event to * @param eventNames - Event names to bind the handler to * @param handler - Handler to bind to the event * @param options - Options to pass to the 'addEventListener' * @return A function to remove the handler again */ declare function once(elm: EventTarget, eventNames: string | string[], handler: EventListenerOrEventListenerObject, options?: OnceEventListenerOptions): VoidFunction; /** * Bind a single fire event handler for one or more event names on `document`. * (Add `when` to the options to conditional trigger the event) * * @param eventNames - Event names to bind the handler to * @param handler - Handler to bind to the event * @param options - Options to pass to the 'addEventListener' * @return A function to remove the handler again */ declare function once(eventNames: string | string[], handler: EventListenerOrEventListenerObject, options?: OnceEventListenerOptions): VoidFunction; export default once;