Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exodusmovement/debounce-and-batch
debounce and batch-process events
https://github.com/exodusmovement/debounce-and-batch
Last synced: 8 days 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T18:47:22.000Z (about 2 years ago)
- Last Synced: 2024-04-15T02:05:23.692Z (7 months ago)
- Language: JavaScript
- Size: 177 KB
- Stars: 3
- Watchers: 22
- 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)
```