Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)
```