UNPKG

@enjoys/react-api

Version:
11 lines (9 loc) 410 B
type Callback<T> = (data: T) => void; declare function useReactEvent<EventKey extends string, T = any>(eventKey: EventKey, handler?: Callback<T>): { emit: (payload?: T) => void; emitOnce: (payload?: T) => void; emitDebounce: (delay: number) => (...args: any[]) => void; listen: (handler: Callback<T>) => () => void; listenOnce: (handler: Callback<T>) => void; }; export { useReactEvent };