【发布时间】:2014-01-07 03:53:12
【问题描述】:
我有以下代码:
async.parallel({
one: function(callback) { gps_helper.get_gps(PEMSID, conn, start, stop, function(fullResults){
callback(fullResults);
}) }, //query for new dataSet
two: function(callback) { admin.getTh(function(gpsThresholds){
callback(gpsThresholds);
}) }
},
function(results){
console.log(results);
console.log('emitting GPS...');
socket.emit('GPS', {gpsResults: results.one, thresholds: results.two, PEMSID: PEMSID, count: count, length: PEMSToDisplay.length, checked: checked});
count++;
});
这不起作用,我的控制台将在回调中完成的第一个查询显示为results。输出中也没有{one: fullResults, two: gpsThresholds} 格式,它只是显示各个函数的回调值。
【问题讨论】: