Class: Queue

Queue

new Queue(asyncNumber, delay, errDelay, loopDelay)

Promise Queue class/ constructor.
Parameters:
Name Type Description
asyncNumber integer Number of concurrent task(s) running.
delay integer Delay of success in ms.
errDelay integer Error delay in ms. If let it undefined, the value will be the same as delay above.
loopDelay integer Delay in looping process. If let it undefined, the value will be the same as delay above.
Properties:
Name Type Description
tasks array Array of tasks of current tasks list.
Source:

Methods

clear(force, forceGc)

Clear current counted done and error results.
Parameters:
Name Type Description
force boolean Force to delete tasks also. If set to true, all queued tasks will be vanished.
forceGc boolean Force doing gc (garbace collection) at the end of clear. This gc is safe to used even without `--expose-gc` option is set, but will do nothing.
Source:

drain(succeed, clear) → {Promise}

Drain is wait until all tasks on the tasks list is finished, then we can chain it like `Promise.all` behaviour.
Parameters:
Name Type Description
succeed boolean Get only succeed promises. The return will be always succeed (then able) but the errors will be printed out to `console.error`.
clear boolean Clear this object @see clear.
Source:
Returns:
Promise object that will resolved with an array of succeeds results.
Type
Promise

pause()

Pause current queue progress. After last running task(s) finished, do nothing.)
Source:

push(task(s))

Push `task` to the tasks list.
Parameters:
Name Type Description
task(s) Task | function Input must be (an array or single item) a function that return a promise object or a task object.
Source:

resume()

Resume current queue progress. Immediately execute current task(s) on tasks list if any.
Source: