UNPKG

@wordpress/compose

Version:
17 lines 1.01 kB
/** * Debounces a function similar to Lodash's `debounce`. A new debounced function will * be returned and any scheduled calls cancelled if any of the arguments change, * including the function to debounce, so please wrap functions created on * render in components in `useCallback`. * * @see https://lodash.com/docs/4#debounce * * @template {(...args: any[]) => void} TFunc * * @param {TFunc} fn The function to debounce. * @param {number} [wait] The number of milliseconds to delay. * @param {import('../../utils/debounce').DebounceOptions} [options] The options object. * @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Debounced function. */ export default function useDebounce<TFunc extends (...args: any[]) => void>(fn: TFunc, wait?: number, options?: import("../../utils/debounce").DebounceOptions): import("../../utils/debounce").DebouncedFunc<TFunc>; //# sourceMappingURL=index.d.ts.map