https://github.com/exodusmovement/debounce-and-batch
debounce and batch-process events
https://github.com/exodusmovement/debounce-and-batch
Last synced: 3 months ago
JSON representation
debounce and batch-process events
- Host: GitHub
- URL: https://github.com/exodusmovement/debounce-and-batch
- Owner: ExodusMovement
- License: mit
- Created: 2020-06-25T13:56:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T18:47:22.000Z (over 2 years ago)
- Last Synced: 2025-02-15T00:42:06.367Z (5 months ago)
- Language: JavaScript
- Size: 177 KB
- Stars: 3
- Watchers: 23
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# debounce-and-batch
debounce and batch-process events
## Usage
```js
const debounceAndBatch = require('debounce-and-batch')// say you want to batch process throwing away the trash
const emptyTrash = debounceAndBatch({
name: 'trash batch-processor',
interval: 1000,
concurrency,
onBatch: async (items) => {
console.log(`emptying ${items.length} from trash`)
},
})eventEmitter.on('trash', emptyTrash)
```