async-task-handler

1.0.1 • Public • Published

Async Task Manager

A simple task manager to help you manage and run tasks sequentially or concurrently in JavaScript.

Installation

npm install async-task-manager

const TaskManager = require('async-task-manager');

// Create a new task manager instance
const taskManager = new TaskManager();

// Add tasks to the manager
taskManager.addTask(() => new Promise(resolve => setTimeout(() => {
  console.log('Task 1 Completed');
  resolve();
}, 1000)));

taskManager.addTask(() => new Promise(resolve => setTimeout(() => {
  console.log('Task 2 Completed');
  resolve();
}, 500)));

taskManager.addTask(() => new Promise(resolve => setTimeout(() => {
  console.log('Task 3 Completed');
  resolve();
}, 2000)));

// Run tasks sequentially
taskManager.runSequential();

Readme

Keywords

none

Package Sidebar

Install

npm i async-task-handler

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

4.12 kB

Total Files

5

Last publish

Collaborators

  • ahmad989