모든 인수를 전달하는 데 문제가 있습니다. 내 약속 콜백은 세 가지 대신 하나만받습니다.자바 스크립트가 모든 인수를 전달하지 않는다는 약속 (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);
});
내가 뭘 잘못하고 있는지 아시겠습니까?
내 돈이 타입 강제로 –