@forest-js/core
Version:
A tiny, functional DOM engine with explicit update and real DOM.
21 lines • 757 B
TypeScript
import { Utility } from "../types";
/**
* @function addEvent
* @description Attaches event listeners to an element.
* Allows specifying event types and handlers.
*
* @template E - Element type.
* @template K - Event key.
* @param type - Event type.
* @param handler - Event handler.
* @param options - Event options.
* @returns Utility function for adding event listeners.
* @example
* ```ts
* const onClick = addEvent("click", (e) => console.log(e.currentTarget))(MyElement);
* ```
*/
export declare const addEvent: <E extends Element, K extends keyof HTMLElementEventMap>(type: K, handler: (e: HTMLElementEventMap[K] & {
currentTarget: E;
}) => void, options?: AddEventListenerOptions) => Utility<E>;
//# sourceMappingURL=event.d.ts.map