UNPKG

@uspk-ui/react-use-event-listener

Version:

A Quick description of the component

8 lines (6 loc) 705 B
declare type Target = EventTarget | null | (() => EventTarget | null); declare type Options = boolean | AddEventListenerOptions; declare function useEventListener<K extends keyof DocumentEventMap>(target: Target, event: K, handler?: (event: DocumentEventMap[K]) => void, options?: Options): VoidFunction; declare function useEventListener<K extends keyof WindowEventMap>(target: Target, event: K, handler?: (event: WindowEventMap[K]) => void, options?: Options): VoidFunction; declare function useEventListener<K extends keyof GlobalEventHandlersEventMap>(target: Target, event: K, handler?: (event: GlobalEventHandlersEventMap[K]) => void, options?: Options): VoidFunction; export { useEventListener };