jh-vue-hooks
Version:
金合Vue Hooks 事件监听hook
32 lines (28 loc) • 905 B
TypeScript
/*
* @Author: wfl
* @LastEditors: wfl
* @description:
* @updateInfo:
* @Date: 2022-07-29 17:31:58
* @LastEditTime: 2022-08-01 10:00:33
*/
import { Ref } from "vue";
declare module 'jh-vue-hooks' {
interface UseEventParams {
el?: Element | Ref<Element | undefined> | Window | any;
name: string;
listener: EventListener;
options?: boolean | AddEventListenerOptions;
autoRemove?: boolean;
isDebounce?: boolean;
wait?: number;
}
interface WindowSizeOptions {
once?: boolean;
immediate?: boolean;
listenerOptions?: AddEventListenerOptions | boolean;
}
export const useEventListener: (UseEventParams) => () => void;
export const useWindowResize: <T>(fn: (T) => void, wait, options?: WindowSizeOptions) => () => void;
export const useTimeoutFn: <T>(fn: (T) => void, wait: number, native?: Boolean) => () => void;
}