queueable-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

queueable-js

Version Build Twitter Follow

Simple queuing functionality with event emitter async call.

Forked and Inspired from async-function-queue

Installation

$ yarn add queueable-js

or,
$ npm install queueable-js

Usage

import Queue from "queueable-js"

const concurrency = 2

// create a queue, defining concurrency
const queue = Queue(concurrency)

// push a function that accepts a callback
// as sole argument
queue.push(function(cb) {
  setTimeout(cb, 1000)
});

Events

// Some emitted events

// queue.event() will returns an instance of EventEmitter
 
queue.event().on('entry', function() {
  console.log('starting to execute function')
})
 
queue.event().on('exit', function() {
  console.log('finished executing function')
})

queue.event().on('drain', function() {
  console.log('queue has drained')
})

Package Sidebar

Install

npm i queueable-js

Weekly Downloads

2

Version

1.0.9

License

MIT

Unpacked Size

11.6 kB

Total Files

5

Last publish

Collaborators

  • puncoz