Skip to content

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.

Installation

Concurrent Tasks is available to install directly via NPM.

Terminal window
npm i concurrent-tasks

Browsers

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

Bun

Terminal window
bun install concurrent-tasks

Deno

import { TaskRunner } from "https://cdn.jsdelivr.net/npm/concurrent-tasks/src/index.ts";

Usage

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