The following code returns only the resultset of getpricingSummary
async.waterfall([
function(callback){
getpricingSummary(elementsParam, function(workloadinfo) {
callback(workloadinfo);
});
},
function(callback){
getPricingforResourceIdentifiers('vm/hpcloud/nova/small,image/hpcloud/nova/ami-00000075', function(pricingDetail) {
callback(pricingDetail);
});
}],
function(result){
console.log(result);
});
]);
The
async
library follows the common Node.js pattern oferror
-first callbacks.To signify that the task was "successful," the 1st argument should be falsy (typically
null
) with any data as the 2nd or after argument.Also note that
async.waterfall()
is intended for passing a result from one task to the next, arriving at just theresult
from the final task (or anerror
).If you want to collect results from each task, try
async.series()
. With it,result
will be anArray
of the data passed from each task.