1.0.0 • Published 2 years ago
@ijx/tasks v1.0.0
Tasks
Manager for task list
Installation
Use the package manager npm to install Tasks.
npm install @ijx/tasksList of methods
constructor(config?: object)ConstructoronEnd(func: function): TasksExecute function after end eventadd(action: function|object): TasksAdd new task to listprocess(): voidStart to process task listpause(): voidPause task listreset(): voidClear 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
});1.0.0
2 years ago