sequential-task-queue
sequential-task-queue copied to clipboard
can I add/remove promises at run time?
var queue = new SequentialTaskQueue();
queue.push(() => {
console.log("first task");
});
setTimeout(()=>{
queue.push(() => {
console.log("second task");
});
}
,500);
will task 1 always complete before task 2?
Yes, tasks are executed in the order they were added, and the next task is executed only if the previous one has been completed or cancelled.