给定的
var promises = [Promise.resolve("a"), Promise.reject("b")];
Promise.all(promises.map(function(p, index) {
return p.then(function(data) {
console.log("inside .map()", data, "index", index)
return data
}, function(err) {
console.log(err);
return err
})
}))
.then(function(complete) {
console.log("all promises after .map()", complete)
}, function(err) {
console.log("err", err)
})
为什么onRejected
不叫在.then(onFulfilled, onRejected)
跟随Promise.all()
?
jsfiddle https://jsfiddle.net/9gprLc7q/