# next-tick-debounce

> Debounce multiple synchronous function calls into a single async call

Latest version **2.0.0** (published 2016-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install next-tick-debounce
pnpm add next-tick-debounce
yarn add next-tick-debounce
bun add next-tick-debounce
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-03-06 |
| First published | 2015-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | async, nextTick, function, call, debounce |

## Links

- npm: https://www.npmjs.com/package/next-tick-debounce
- Repository: https://github.com/bendrucker/next-tick-debounce
- Homepage: https://github.com/bendrucker/next-tick-debounce#readme
- Issues: https://github.com/bendrucker/next-tick-debounce/issues
- npm.io page: https://npm.io/package/next-tick-debounce

## Dependencies (3)

- [to-array](https://npm.io/package/to-array.md) ~0.1.4
- [next-tick](https://npm.io/package/next-tick.md) ~0.2.2
- [assert-function](https://npm.io/package/assert-function.md) ~1.0.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2016-03-06
- 1.0.0 — 2015-09-03

## README

# next-tick-debounce [![Build Status](https://travis-ci.org/bendrucker/next-tick-debounce.svg?branch=master)](https://travis-ci.org/bendrucker/next-tick-debounce)

> Debounce multiple synchronous function calls into a single async call


## Install

```
$ npm install --save next-tick-debounce
```


## Usage

```js
var debounce = require('next-tick-debounce')
var i = 0
var debounced = debounce(function () {
  console.log(i++)  
})

debounced()
debounced()
debounced()

//=> 0 (only called once)

setTimeout(debounced, 10)

//=> 1
```

The debounced function runs with the last set of arguments/context.

## API

#### `debounce(fn)` -> `function`

##### fn

*Required*  
Type: `fn`

A function that should run at most once per tick.

## License

MIT © [Ben Drucker](http://bendrucker.me)

---
_Source: https://npm.io/package/next-tick-debounce · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
