Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
concurrent-tasks
Advanced tools
Readme
A simple task runner which will run all tasks till completion, while maintaining concurrency limits.
Read the full documentation at the website
Concurrent Tasks mimics a queue by using JavaScript's inbuilt array data type. Each task is a function which signals completion back to the runner.
The minimalism of Concurrent Tasks makes it an easy-to-use solution across any framework or flavour of JavaScript. It has ZERO dependencies and can be used virtually in any scenario. With a minified and gzipped size of 2.7kB, it is the ultimate lightweight tool for your concurrency needs.
# NPM
npm i concurrent-tasks
# Yarn
yarn add concurrent-tasks
# PNPM
pnpm i concurrent-tasks
<script
src="https://cdn.jsdelivr.net/npm/concurrent-tasks/umd/concurrent-tasks.min.js"
type="text/javascript"
></script>
bun install concurrent-tasks
import { TaskRunner } from "https://cdn.jsdelivr.net/npm/concurrent-tasks/src/index.ts";
Important: Each task passed to the task runner, necessarily has to call the done function. If not, your queue won't process properly.
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());
runner.start();
FAQs
A simple task runner which will run tasks concurrently while maintaining limits.
The npm package concurrent-tasks receives a total of 1,219 weekly downloads. As such, concurrent-tasks popularity was classified as popular.
We found that concurrent-tasks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.