Skip to content
This repository was archived by the owner on Aug 17, 2023. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

12 Commits

Repository files navigation

thunk-queue

Thunk queue for uncertainty tasks evaluation.

NPM versionBuild StatusDownloads

Demo

constthunkQueue=require('thunk-queue')constqueueT=thunkQueue()queueT(function(err,res){// It is will be run after all thunkable task finished in queue.console.log(err,res)})queueT.push(1)// push a primitive value to queuequeueT.push(Promise.resolve(1))// push a promise to queue// queueT.push(...), support all thunkable value, such as primitive value, thunk function, promise, generator object, generator function...queueT.end()// end the queue.

Installation

npm install thunk-queue

API

constthunkQueue=require('thunk-queue')

thunkQueue([thunkable])

Return a thunk function with a closure queue.

constqueueT=thunkQueue()

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;

About

Thunk queue for uncertainty tasks evaluation.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages