我正在使用async.js来管理一些并行加载。当我第一次调用这个函数时,一切都很好。当我把它称为第二个时,异步会生气,我的回调(突出显示)被第二次调用,好像它是相同的回调。这是怎么回事?
initialize: function (complete){
//complete any initial setup work required for the page here
//crashAjax.loadthis, loadthat
async.parallel([
function(callback){
templateHandler.onLoad(moduleSection, function () {
callback();
});
templateHandler.load(moduleSection, templates);
},
function(callback){
users = ajax.getUsersForDepartment();
callback(); <-"Uncaught Error: Callback was already called."
}
],
// optional callback
function(err, results){
complete();
});
},
谢谢!