UNPKG

793 BTypeScriptView Raw
1import * as React from 'react';
2export interface EventListenerOptions<T extends EventTypes = 'click'> {
3 /** Indicating that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. */
4 capture?: boolean;
5 /** A function which receives a notification when an event of the specified type occurs. */
6 listener: EventHandler<T>;
7 /** A ref object with a target node. */
8 targetRef: TargetRef;
9 /** A case-sensitive string representing the event type to listen for. */
10 type: T;
11}
12export declare type EventHandler<T extends EventTypes> = (e: DocumentEventMap[T]) => void;
13export declare type EventTypes = keyof DocumentEventMap;
14export declare type TargetRef = React.RefObject<Node | Window>;