thunks/thunk-queue

Name: thunk-queue

Owner: thunks

Description: Thunk queue for uncertainty tasks evaluation.

Created: 2015-03-20 11:59:36.0

Updated: 2018-04-11 07:24:37.0

Pushed: 2017-06-04 13:52:56.0

Homepage:

Size: 10

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

thunk-queue

Thunk queue for uncertainty tasks evaluation.

NPM version Build Status Downloads

thunks
Demo
t thunkQueue = require('thunk-queue')
t queueT = thunkQueue()

eT(function(err, res) {
 It is will be run after all thunkable task finished in queue.
nsole.log(err, res)


eT.push(1) // push a primitive value to queue
eT.push(Promise.resolve(1)) // push a promise to queue

ueueT.push(...), support all thunkable value, such as primitive value, thunk function, promise, generator object, generator function...

eT.end() // end the queue.
Installation
install thunk-queue
API
t thunkQueue = require('thunk-queue')
thunkQueue([thunkable])

Return a thunk function with a closure queue.

t queueT = 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;


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.