• Adds a task to the task list.

  • Requires a function which calls the done callback upon completion.

  • Returns true upon successful addition.


add(task: Function, [first: Boolean])


import TaskRunner from 'concurrent-tasks';
const runner = new TaskRunner();
runner.add(done => setTimeout(() => done(), 2000));

Further Reading

Accepts an additional parameter called first as a booleanflag. Setting it as true will add the task to the top of the task list.

See: addFirst

All created instances have autoStart enabled by default. This means, as soon as you add a task to your instance, it will start executing it.