nexbounce
Version:
A debouncer library based on microtasks.
39 lines (24 loc) • 1.04 kB
Markdown
# nexbounce
A debouncer library based on microtasks.
[](https://npmjs.com/package/nexbounce)
[](https://npmjs.com/package/nexbounce)
[](https://github.com/Hawmex/nexbounce/issues)
[](https://github.com/Hawmex/nexbounce)
## Demo
You can try the demo [here](https://codepen.io/Hawmed/pen/bGqgGrR).
## Installation
```
npm i nexbounce
```
## Documentation
You can find documentation [here](https://hawmex.github.io/nexbounce/).
## Example
```js
import { Debouncer } from 'nexbounce/nexbounce.js';
let counter = 0;
const debouncer = new Debouncer();
nexbounce.enqueue(() => (counter += 3));
nexbounce.enqueue(() => (counter += 1));
nexbounce.enqueue(() => (counter += 2));
setTimeout(() => console.log(counter)); // 2
```