UNPKG

@utilify/core

Version:

Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B

11 lines 684 B
/** * Registers an event listener and returns a function to remove it. * @template T * @param {T} target - The event target. * @param {string} event - The event name. * @param {(this: T, ev: Event) => any} listener - The event listener. * @param {boolean|AddEventListenerOptions} [options] - Listener options. * @returns {() => void} Function to remove the listener. */ export default function on<T extends Window | Document | HTMLElement | EventTarget>(target: T, event: keyof WindowEventMap | keyof DocumentEventMap | keyof HTMLElementEventMap, listener: (this: T, ev: Event) => any, options?: boolean | AddEventListenerOptions): () => void; //# sourceMappingURL=on.d.ts.map