dong-queue

simple async queue runner

Usage no npm install needed!

<script type="module">
  import dongQueue from 'https://cdn.skypack.dev/dong-queue';
</script>

README

dong-queue

NPM version Build Status

simple (a)sync queue runner

Install

npm install --save dong-queue

Usage

run

synchronous. run queue member step by step (one invokes by previous one with next).

var queue = new Queue()

// use function
queue.use(function([arg1, arg2, ...], next){
  // do some (a)sync job, then
  next()
})

// use functions
queue.use([function([arg1, arg2, ...], next){
  // do some (a)sync job, then
  next()
}, ...])

// dynamically pass arguments to queue members
queue.run([arg1, arg2, ... ], [function callback([arg1, arg2, ... ]) {
  // do some callbacks
}])

any

asynchronous. if any member of the queue is finished, call the callback.

all

asynchronous. if all members of the queue is finished, call the callback.