export interface DebounceOptions { /** The number of milliseconds to delay. Default: 1000 */ wait?: number; /** Specify invoking on the leading edge of the timeout. Default: false */ leading?: boolean; /** Specify invoking on the trailing edge of the timeout. Default: true */ trailing?: boolean; /** The maximum time func is allowed to be delayed before it's invoked. Default: undefined (no max) */ maxWait?: number; } export interface DebouncedFn unknown> { /** Invoke and pass parameters to fn */ run: (...args: Parameters) => void; /** Cancel the invocation of currently debounced function */ cancel: () => void; /** Immediately invoke currently debounced function */ flush: () => void; } /** * A hook that creates a debounced function with advanced options. * * Useful for reducing the frequency of expensive operations like: * - Network requests * - Store updates * - Heavy computations * * @param fn - The function to debounce * @param options - Debounce options including wait, leading, trailing, maxWait * @returns Object with run, cancel, and flush methods * * @example * ```tsx * // Basic usage - debounce store updates * const { run: debouncedUpdate } = useDebounceFn( * (values: Record) => { * ops.update({ data: { nodes: [{ key, ...values }] } }); * }, * { wait: 150 } * ); * * // With maxWait for guaranteed updates * const { run: debouncedSync } = useDebounceFn( * (newCtrl: number[]) => { * ops.update({ data: { nodes: [{ key, ctrl: newCtrl }] } }); * }, * { wait: 150, maxWait: 500 } * ); * ``` */ export declare function useDebounceFn unknown>(fn: T, options?: DebounceOptions): DebouncedFn;