UNPKG

ahooks

Version:
11 lines (10 loc) • 577 B
import type { BasicTarget } from '../utils/domTarget'; type DocumentEventKey = keyof DocumentEventMap; export type UseClickAwayEventName = DocumentEventKey | DocumentEventKey[]; export interface UseClickAwayOptions { eventName?: UseClickAwayEventName; /** Whether the away listener is active. Defaults to `true`. */ enabled?: boolean; } declare const useClickAway: <T extends Event = Event>(onClickAway: (event: T) => void, target: BasicTarget | BasicTarget[], eventNameOrOptions?: UseClickAwayEventName | UseClickAwayOptions) => void; export default useClickAway;