source: imaps-frontend/node_modules/react-use/lib/useEvent.d.ts@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 937 bytes
RevLine 
[d565449]1export interface ListenerType1 {
2 addEventListener(name: string, handler: (event?: any) => void, ...args: any[]): any;
3 removeEventListener(name: string, handler: (event?: any) => void, ...args: any[]): any;
4}
5export interface ListenerType2 {
6 on(name: string, handler: (event?: any) => void, ...args: any[]): any;
7 off(name: string, handler: (event?: any) => void, ...args: any[]): any;
8}
9export declare type UseEventTarget = ListenerType1 | ListenerType2;
10declare type AddEventListener<T> = T extends ListenerType1 ? T['addEventListener'] : T extends ListenerType2 ? T['on'] : never;
11export declare type UseEventOptions<T> = Parameters<AddEventListener<T>>[2];
12declare const useEvent: <T extends UseEventTarget>(name: Parameters<AddEventListener<T>>[0], handler?: Parameters<AddEventListener<T>>[1] | null | undefined, target?: Window | T | null, options?: UseEventOptions<T> | undefined) => void;
13export default useEvent;
Note: See TracBrowser for help on using the repository browser.