1.2.0 • Published 7 years ago

thunk-queue v1.2.0

Weekly downloads
46
License
-
Repository
github
Last release
7 years ago

thunk-queue

Thunk queue for uncertainty tasks evaluation.

NPM version Build Status Downloads

thunks

Demo

const thunkQueue = require('thunk-queue')
const queueT = 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 queue
queueT.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

const thunkQueue = require('thunk-queue')

thunkQueue(thunkable)

Return a thunk function with a closure queue.

const 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;

1.2.0

7 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago