task-queue
This module allows you to run the queue of the asynchronous tasks in the form of a queue (so far parallel).
Install
npm i async-task-queue-runner
Usage
Queue constructor
{ return { let queue = ; let tasks = ; let completeTask = 0; tasks; };}; { return { ; };};
Task runner
{ let tasks = taskFactory taskFactory taskFactory ; let { console; }; return success;}; { return { ; };};
API
parallel
The module allows you to run asynchronous tasks in parallel
parallel.Queue(limit)
it's a task queue class.
limit - number of tasks that run simultaneously in parallel. Default 0 (running all tasks in parallel).
Instance methods
queue.addTask(task)
It's method push task into queue.
queue.next()
Call the next task. In the existing queue, it is called automatically.
parallel.runner(tasks, limit, retryCount)(success, error, context)
The function that creates the queue and allows you to add the necessary handlers to each task in a given context.
tasks - array of asynchronous tasks.
limit - number of tasks that run simultaneously in parallel. Default 0 (running all tasks in parallel). Optional.
retryCount - number of attempts to complete the task, if it was completed with an error. Default 0 (without attempting to perform task again). Optional.
success - success function like a promise success function. Optional.
error - error function like a promise success function. Optional.
context - context for success and error function. Optional.
License
MIT © nlapshin