🎬 Getting Started

Getting started with Concurrent Tasks is super easy. The practical nomenclature and the simplicity of it's API is the true power behind it.


You can install via NPM

npm install concurrent-tasks

Or you can add it via a script tag

<script src="https://cdn.jsdelivr.net/npm/concurrent-tasks/umd/concurrent-tasks.min.js" type="text/javascript"></script>


The below code should give you an idea of how easy it really is to start a task runner.

In this case, we are pushing a thousand tasks to our runner which is an instance of the TaskRunner provided by Concurrent Tasks. Each "task" will resolve at a random time.

import TaskRunner from 'concurrent-tasks';
const runner = new TaskRunner();
function generateTasks() {
const tasks = [];
let count = 1000;
while(count) {
tasks.push(done => {
setTimeout(() => {
}, Math.random() * 1000)
return tasks;

Thats it!


Each task passed to the task runner, necessarily has to call the done function. If not, your queue won't process properly.

See: The Done Callback

You will notice we have used addMultiple here, which is an in-built method that lets us add multiple tasks to our task runner.