@ijx/tasks
v1.0.0
Published
Task manager
Downloads
1
Readme
Tasks
Manager for task list
Installation
Use the package manager npm to install Tasks.
npm install @ijx/tasks
List of methods
constructor(config?: object)
ConstructoronEnd(func: function): Tasks
Execute function after end eventadd(action: function|object): Tasks
Add new task to listprocess(): void
Start to process task listpause(): void
Pause task listreset(): void
Clear task list and stop
Example usage
// Import module
import Tasks from "@ijx/tasks"
// Create variable and settings
const tasks = new Tasks({
auto: true // Start process with add function, default true
});
tasks.onEnd(() => console.log("Finish all tasks!"));
// Add tasks
tasks.add(async () => {
// Slow function 1
});
tasks.add(async () => {
// Slow function 2
});