# wrDebounce

> Runs a callback once calls have stopped for `waitMs`.

Source: https://ngwr.dev/reference/utils/wr-debounce  
Kind: Util  
Updated in v16  
Optional

## Usage

Call `.cancel()` on teardown to drop a pending call.

```angular-ts
import { wrDebounce } from 'ngwr/utils';

const onResize = wrDebounce(() => recalcLayout(), 150);
window.addEventListener('resize', onResize);
destroyRef.onDestroy(() => onResize.cancel());
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrDebounce(fn, waitMs)` | Returns a wrapper that calls `fn` once `waitMs` pass with no new call. `.cancel()` drops a pending call. | `(fn, ms) => WrDebouncedFn` | `—` |

## See also

- [wrThrottle](https://ngwr.dev/reference/utils/wr-throttle) — Runs a callback at most once every waitMs, on the leading and the trailing edge.
- [Select](https://ngwr.dev/reference/components/select) — Pick one or several values from a list, with search and free-text tags.
- [Command Palette](https://ngwr.dev/reference/components/command-palette) — A ⌘K search box that finds and runs your app's actions.
