1 | type DocumentEventHandler<K extends keyof DocumentEventMap> = (this: Document, ev: DocumentEventMap[K]) => any;
|
2 | /**
|
3 | * Attaches an event handler outside directly to the `document`,
|
4 | * bypassing the react synthetic event system.
|
5 | *
|
6 | * ```ts
|
7 | * useGlobalListener('keydown', (event) => {
|
8 | * console.log(event.key)
|
9 | * })
|
10 | * ```
|
11 | *
|
12 | * @param event The DOM event name
|
13 | * @param handler An event handler
|
14 | * @param capture Whether or not to listen during the capture event phase
|
15 | */
|
16 | export default function useGlobalListener<K extends keyof DocumentEventMap>(event: K, handler: DocumentEventHandler<K>, capture?: boolean | AddEventListenerOptions): void;
|
17 | export {};
|