Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

concurrent-tasks

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concurrent-tasks

A simple task runner which will run tasks concurrently while maintaining limits.

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by4.55%
Maintainers
0
Weekly downloads
 
Created
Source

Concurrent Tasks logo

Concurrent Tasks

A simple task runner which will run all tasks till completion, while maintaining concurrency limits.

Read the full documentation at the website


Introduction

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.

  • Vanilla JavaScript
  • Frontend Frameworks (React, Vue, Angular, etc)
  • Backend Frameworks (Express, Hapi, Koa, etc)
  • NPM Module
  • Node CLI Application

Installation

Node

# NPM
npm i concurrent-tasks

# Yarn
yarn add concurrent-tasks

# PNPM
pnpm i concurrent-tasks

Browser

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

Bun

bun install concurrent-tasks

Deno

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

Usage

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();

Keywords

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc