smart-task

1.0.0 • Public • Published

smart-task

introduction

A task queue that is simple and easy to use, use Typescript wirte, full encapsulation of tasks and task managers, so you can start, pause, resume and close them.

usage

import { CommonTaskImpl } from "./lifecycle/CommonTaskImpl";
import { TaskManager } from "./lifecycle/TaskManager";

const taskList: CommonTaskImpl[] = []

const task = new CommonTaskImpl(() => {
    console.log(1 + 1);
});

const task2 = new CommonTaskImpl(() => {
    console.log(1 + 2);
});

const task3 = new CommonTaskImpl(() => {
    console.log(1 + 3);
});


taskList.push(task)
taskList.push(task2)
taskList.push(task3)

const taskMsg = new TaskManager(taskList)

taskMsg.start()
taskMsg.pause()

setTimeout(() => {
    taskMsg.resume()
}, 3000);

Package Sidebar

Install

npm i smart-task

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.02 kB

Total Files

11

Last publish

Collaborators

  • alaia001