/** * Default debounce delay in milliseconds. * Used for autocomplete/typeahead fetch operations to avoid * excessive backend calls during rapid user input. */ export declare const DEFAULT_DEBOUNCE_MS = 300; /** * Returns a debounced version of the given callback. * * The returned function delays invoking `callback` until after `delay` ms * have elapsed since the last invocation. Useful for search/autocomplete * inputs that trigger backend fetches. * * - Automatically cleans up pending timers on unmount. * - Provides a `cancel()` method on the returned function to manually * discard any pending invocation. * - The callback reference is always kept up-to-date (no stale closures). * * @param callback - The function to debounce * @param delay - Debounce delay in ms (default: {@link DEFAULT_DEBOUNCE_MS}) * @returns A debounced function with an additional `cancel` method * * @example * ```tsx * const fetchSuggestions = useDebouncedCallback(async (text: string) => { * const results = await api.search(text); * setOptions(results); * }); * * fetchSuggestions(e.target.value)} /> * ``` */ export declare function useDebouncedCallback(callback: (...args: Args) => void, delay?: number): ((...args: Args) => void) & { cancel: () => void; }; //# sourceMappingURL=use-debounced-callback.d.ts.map