/** * Debounce updates to a provided value * * @param value New value to set as * @param delay Number of milliseconds to delay updating value * @returns Debounced value */ export declare function useDebouncedValue(value: string | null, delay: number): string | null; /** * @deprecated Prefer using `useDebouncedValue` instead */ export declare const useDebounce: typeof useDebouncedValue; declare type FN = (...args: unknown[]) => void | Promise; /** * Debounce dispatching a function. * * By default the function will wait [timeout] amount of time before * dispatching the function. If the [leading] arg is set to `true`, then * this logic will change to dispatching on the first request and ignoring * all subsequent requests in the [timeout] period proceeding. * * @param fn Function to be called * @param timeout Number of milliseconds * @param leading If the dispatch should fire on the leading request. Default is last recieved request. * @returns Dispatch function * @see https://www.freecodecamp.org/news/javascript-debounce-example/ * @example * const fn = useDebouncedFn(() => {}, 1000); * fn(); * fn(); * fn(); <-- only this one will run * @example * const fn = useDebouncedFn(() => {}, 1000, true); * fn(); <-- only this one will run * fn(); * fn(); */ export declare function useDebouncedFn(fn: Func, timeout: number, leading?: boolean): (...args: Parameters) => void; export {};