1.0.0 • Published 5 months ago

@ijx/tasks v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Tasks

Manager for task list

Installation

Use the package manager npm to install Tasks.

npm install @ijx/tasks

List of methods

  • constructor(config?: object) Constructor
  • onEnd(func: function): Tasks Execute function after end event
  • add(action: function|object): Tasks Add new task to list
  • process(): void Start to process task list
  • pause(): void Pause task list
  • reset(): 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
});
1.0.0

5 months ago