Class comb.PromiseList
Extends
comb.Promise.
Defined in: promise.js.
- Methods borrowed from class comb.Promise:
- addCallback, addErrback, callback, chain, chainBoth, errback, then
Class Detail
comb.PromiseList(defs, normalizeResults)
PromiseList object used for handling a list of Promises
Example 1 :
var myFunc = function(){
var promise = new Promise();
//callback the promise after 10 Secs
setTimeout(hitch(promise, "callback"), 10000);
return promise;
}
var myFunc2 = function(){
var promises =[];
for(var i = 0; i < 10; i++){
promises.push(myFunc);
}
//create a new promise list with all 10 promises
return new PromiseList(promises);
}
var pl = new comb.PomiseList([myFunc(), myFunc2()]);
pl.then(do something...)
pl.addCallback(do something...)
pl.cain(myfunc).then(do something...)
pl.cain(myfunc).addCallback(do something...)
- Parameters:
- {comb.Promise[]} defs Optional, Default: []
- the list of promises
- normalizeResults
this.__defLength = defs.length;
this.__errors = [];
this.__results = [];
this.normalizeResults = base.isBoolean(normalizeResults) ? normalizeResults : false;
this._super(arguments);
defs.forEach(this.__addPromise, this);
Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:12 GMT-0600 (CST)