https://github.com/ztrehagem/synchronized-debounce
https://github.com/ztrehagem/synchronized-debounce
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ztrehagem/synchronized-debounce
- Owner: ztrehagem
- Created: 2019-05-22T07:49:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-22T15:00:04.000Z (about 6 years ago)
- Last Synced: 2025-02-28T22:51:24.464Z (4 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @ztrehagem/synchronized-debounce
**synchronized-debounce** makes easy to define debounced functions with async functions.
It's simple to use:
```js
const synchronizedDebounce = require('@ztrehagem/synchronized-debounce')const debounced = synchronizedDebounce(asyncFn, interval)
debounced() // just
debounced() // call
debounced() // anytime
debounced() // manytimes
```Roughly the behavior is same to the _debounce_ function.
If the _debounce_ tries calling `asyncFn` while awaiting previous execution of `asyncFn`, the next calling is deferred until exiting the previous one.