We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.then
原文: Promise.all 接收一个 promise对象的数组作为参数,当这个数组里的所有promise对象全部变为resolve或reject状态的时候,它才会去调用 .then 方法。
Promise.all
而实际上应该是: Promise.all 是在所有promise对象都变为resolve或者只要有一个变为reject时,才会去调用.then
var p1 = Promise.resolve(1); var p2 = Promise.reject(2); var p3 = new Promise(function(resolve, reject) { setTimeout(function() { console.log('p3') resolve(3); }, 500); }); p3.then(function(res) { console.log('p3') }); Promise.all([p1, p2, p3]).then(function(res) { console.log(res) }, function(err) { console.warn(err) });
The text was updated successfully, but these errors were encountered:
说白了就是亦或的关系,有且只有一个为假,则全部为假。不管是假是真都会调用.all这个对象的then就会被调用
Sorry, something went wrong.
No branches or pull requests
原文:
Promise.all
接收一个 promise对象的数组作为参数,当这个数组里的所有promise对象全部变为resolve或reject状态的时候,它才会去调用.then
方法。而实际上应该是:
Promise.all 是在所有promise对象都变为resolve或者只要有一个变为reject时,才会去调用
.then
先抛出警告:2,再输出:p3
The text was updated successfully, but these errors were encountered: