Nic*_*ick 16 javascript node.js promise deferred q
我无法通过所有论点.我的承诺回调只收到一个而不是三个:
var asyncFunction= function(resolve) {
setTimeout(function() {
resolve("Some string that is passed", "and another", "third");
}, 1000);
};
var promiseFunction = function () {
var deferred = Q.defer();
asyncFunction(deferred.resolve);
return deferred.promise;
};
promiseFunction().then(function() {
// Only one argument is passed here instead of 3
// { '0': 'Some string that is passed' }
console.log(arguments);
});
Run Code Online (Sandbox Code Playgroud)
知道我做错了什么吗?