Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve documentation by adding descriptions
  • Loading branch information
sarayourfriend committed May 20, 2021
commit 7e1ee137db3eabef0244f7a938566abbe16bf496
10 changes: 7 additions & 3 deletions packages/compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@ 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`.

_Related_

- <https://docs-lodash.com/v4/debounce/>

_Parameters_

- _fn_ `TFunc`:
- _wait_ `[number]`:
- _options_ `[import('lodash').DebounceSettings]`:
- _fn_ `TFunc`: The function to debounce.
- _wait_ `[number]`: The number of milliseconds to delay.
- _options_ `[import('lodash').DebounceSettings]`: The options object.

_Returns_

Expand Down
8 changes: 5 additions & 3 deletions packages/compose/src/hooks/use-debounce/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import { useEffect } from '@wordpress/element';
* including the function to debounce, so please wrap functions created on
* render in components in `useCallback`.
*
* @see https://docs-lodash.com/v4/debounce/
*
* @template {(...args: any[]) => void} TFunc
*
* @param {TFunc} fn
* @param {number} [wait]
* @param {import('lodash').DebounceSettings} [options]
* @param {TFunc} fn The function to debounce.
* @param {number} [wait] The number of milliseconds to delay.
* @param {import('lodash').DebounceSettings} [options] The options object.
* @return {TFunc & import('lodash').Cancelable} Debounced function.
*/
export default function useDebounce( fn, wait, options ) {
Expand Down