Skip to content

HeyAlaia/smart-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

An intelligent task queue manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published