@miyauci/get-event-listeners
Version:
Ponyfill for getEventListeners
31 lines (30 loc) • 1.49 kB
TypeScript
import type { ComparableEventListenerLike, EventListenerLike } from "./types.js";
/** To flatten {@linkcode options}.
* @see https://dom.spec.whatwg.org/#concept-flatten-options
*/
export declare function flatOptions(options?: boolean | EventListenerOptions): boolean;
export type NormalizedOptions = Pick<EventListenerLike, keyof AddEventListenerOptions>;
/** To flatten {@linkcode options} more.
* @see https://dom.spec.whatwg.org/#event-flatten-more
*/
export declare function flatOptionsMore(options?: boolean | AddEventListenerOptions): NormalizedOptions;
/** Return default passive value.
* @see https://dom.spec.whatwg.org/#default-passive-value
*/
export declare function defaultPassiveValue(type: string, target: EventTarget): boolean;
interface NodeLike {
readonly ownerDocument: object | null;
}
/** Whether the {@linkcode input} is {@linkcode NodeLike} or not. */
export declare function isNodeLike(input: object): input is NodeLike;
/** Whether the {@linkcode input} is {@linkcode Window} or not.
* This works universally.
*/
export declare function isWindow(input: unknown): input is Window;
/** {@linkcode listener} to Function.
* if {@linkcode listener} is function, return it; otherwise return bound `handleEvent`.
*/
export declare function toHandler(listener: EventListenerOrEventListenerObject): EventListener;
/** Return {@linkcode listener} representation key. */
export declare function toKey(listener: ComparableEventListenerLike): object;
export {};