Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@coya/task-manager
Advanced tools
Scheduler for run tasks successively or simultaneously.
npm install @coya/task-manager
git clone https://github.com/Cooya/TaskManager
cd TaskManager
npm install // it will also install the development dependencies
npm run build
npm run example // run the example script in "examples" folder
const { TaskManager, Task } = require('@coya/task-manager');
const firstTask = new Task('firstTask', 10, function() {
console.log('hello');
return Promise.resolve();
});
const secondTask = new Task('secondTask', 5, function() {
console.log('hola');
return Promise.resolve();
});
const thirdTask = new Task('thirdTask', 2, function() {
console.log('failure');
return Promise.reject();
});
const taskManager = new TaskManager();
taskManager.onTaskEnd(function(task) {
console.log('The task "' + task.name + '" has been removed from the task manager.');
});
taskManager.onEnd(function() {
console.log('All tasks have been stopped, task manager shutted down.');
});
taskManager.processAsynchronousTasks([firstTask, secondTask, thirdTask]);
Process tasks list successively, it means that tasks are executed one by one. The following task is executed once the previous one is done.
Parameter | Type | Description | Default value |
---|---|---|---|
taskList | array | list of objects implementing or inheriting the Task class | none |
Process tasks list simultaneously, it means that tasks are executed in the same time (using setTimeout()). It is different from setInterval() because the timer is launched after the task has been processed.
Parameter | Type | Description | Default value |
---|---|---|---|
taskList | array | list of objects implementing or inheriting the Task class | none |
The Task class, and so its constructor, contains three fields :
FAQs
Scheduler for run tasks successively or simultaneously
The npm package @coya/task-manager receives a total of 1 weekly downloads. As such, @coya/task-manager popularity was classified as not popular.
We found that @coya/task-manager demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.