sequential-task-queue icon indicating copy to clipboard operation
sequential-task-queue copied to clipboard

can I add/remove promises at run time?

Open powerbilayeredmap opened this issue 5 years ago • 1 comments

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?

powerbilayeredmap avatar Mar 22 '19 20:03 powerbilayeredmap

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.

BalassaMarton avatar Mar 23 '19 09:03 BalassaMarton