1.0.9 • Published 4 years ago

queueable-js v1.0.9

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

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')
})
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago