Files
NapCatQQ/.pnpm-store/v3/files/e5/f2fe8d079c622509b0d79e5a3bd53bb25e614c90a244a3579ac9d39b4d168eaaff95573c37bff3433fecd02faf465f93b06d748976cb6d12130c1af5c547da
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

18 lines
1.2 KiB
Plaintext

import type { BasicTarget } from '../utils/domTarget';
type noop = (...p: any) => void;
export type Target = BasicTarget<HTMLElement | Element | Window | Document>;
type Options<T extends Target = Target> = {
target?: T;
capture?: boolean;
once?: boolean;
passive?: boolean;
enable?: boolean;
};
declare function useEventListener<K extends keyof HTMLElementEventMap>(eventName: K, handler: (ev: HTMLElementEventMap[K]) => void, options?: Options<HTMLElement>): void;
declare function useEventListener<K extends keyof ElementEventMap>(eventName: K, handler: (ev: ElementEventMap[K]) => void, options?: Options<Element>): void;
declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (ev: DocumentEventMap[K]) => void, options?: Options<Document>): void;
declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (ev: WindowEventMap[K]) => void, options?: Options<Window>): void;
declare function useEventListener(eventName: string | string[], handler: (event: Event) => void, options?: Options<Window>): void;
declare function useEventListener(eventName: string | string[], handler: noop, options: Options): void;
export default useEventListener;