Class comb.PromiseList
Extends
comb.Promise.
Defined in: promise.js.
Constructor Attributes | Constructor Name and Description |
---|---|
comb.PromiseList(defs)
PromiseList object used for handling a list of Promises
|
- Methods borrowed from class comb.Promise:
- addCallback, addErrback, callback, chain, errback, then
Class Detail
comb.PromiseList(defs)
PromiseList object used for handling a list of Promises
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