rsuite
Version:
A suite of react components
10 lines (9 loc) • 506 B
TypeScript
/**
* Attach the event handler directly to the specified DOM element.
*
* @param element The target to listen for events on
* @param event The DOM event name
* @param handler An event handler
* @param capture Whether or not to listen during the capture event phase
*/
export default function useEventListener<K extends keyof DocumentEventMap>(eventTarget: EventTarget | (() => EventTarget), event: K, listener: EventListenerOrEventListenerObject, capture?: boolean | AddEventListenerOptions): void;