ttq
A node.js queue that tests its contents on an interval and calls either a success
or fail
function with the current contents of the queue.
Install
npm install ttq
Options
asyncTest
: Boolean : Whether the test should pass/listen for a callbacktest
: Function(Array) : The function that gets passed all queued items everyinterval
to determine whether asuccess
orfail
functions get called. Returns a Boolean.success
: Function(Array) : The function that gets passed all queued items if thetest
function returnstrue
.fail
: Function(Array) : The function that gets passed all queued items if thetest
function returnsfalse
.interval
: Number : The time in milliseconds between calls oftest
.context
: Object : Thethis
context for all function calls (success
,fail
,test
).
Usage
var TTQ = ; var ttq = { return arraylength > 1000; } { this; } { // it doesn't matter. it's in the past } interval: 200 context: this;
Methods
push(item)
Push an item onto the queue.
pop()
Pop an item off the queue.
License
MIT