# wrThrottle

> Runs a callback at most once every `waitMs`, on the leading and the trailing edge.

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

## Usage

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

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

const onScroll = wrThrottle(() => trackScroll(), 100);
window.addEventListener('scroll', onScroll);
destroyRef.onDestroy(() => onScroll.cancel());
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrThrottle(fn, waitMs)` | Returns a wrapper that calls `fn` at most every `waitMs`, on the leading and trailing edge. `.cancel()` drops a pending call. | `(fn, ms) => WrThrottledFn` | `—` |

## See also

- [wrDebounce](https://ngwr.dev/reference/utils/wr-debounce) — Runs a callback once calls have stopped for waitMs.
