thunk-queue
Thunk queue for uncertainty tasks evaluation.
thunks
Demo
const thunkQueue = const queueT = queueT // push a primitive value to queuequeueT // push a promise to queue // queueT.push(...), support all thunkable value, such as primitive value, thunk function, promise, generator object, generator function... queueT // end the queue.
Installation
npm install thunk-queue
API
const thunkQueue =
thunkQueue([thunkable])
Return a thunk function with a closure queue.
const queueT =
queueT.push(thunkable)
Push thunkable task to the thunk
's queue, thunkable task will be eager evaluated, return the queueT
;
queueT.end([thunkable])
End the thunk
's queue. the thunk
will be evaluated after all tasks finished in queue. return the queueT
;