debounce-and-batch

1.0.0 • Public • Published

debounce-and-batch

debounce and batch-process events

Usage

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)

Readme

Keywords

none

Package Sidebar

Install

npm i debounce-and-batch

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.66 kB

Total Files

5

Last publish

Collaborators

  • tenaciousmv