UNPKG

@figliolia/drag-detector

Version:

Mouse and Touch driven drag detection for DOM elements

18 lines (17 loc) 593 B
import { DragDetector } from "./DragDetector"; import type { IDragDetectorOptions } from "./types"; /** * useDragDetector * * Sets up a `DragDetector` instance with the specified options * and returns it. When the hook unmounts, the `DragDetector` * instance is automatically destroyed * * To attach your drag detector instance to a DOM node: * ```tsx * const detector = useDragDetector(options); * * <div className='my-element' {...detector.bindings} /> * ``` */ export declare const useDragDetector: <T extends HTMLElement>(options: IDragDetectorOptions<T>) => DragDetector<T>;