feat: add promise.any#1001
Merged
leviding merged 3 commits intojavascript-tutorial:masterfrom Feb 4, 2022
Merged
Conversation
songhn233
suggested changes
Feb 2, 2022
| 这里第一个 promise 最快,所以它变成了结果。第一个 settled 的 promise “赢得了比赛”之后,所有进一步的 result/error 都会被忽略。 | ||
|
|
||
| ## Promise.any | ||
| 与 `Promise.race` 类似,区别在于只要其中的一个 promise 成功,就返回那个已经成功的 promise 。如果可迭代对象中没有一个 promise 成功(即所有的 promises 都失败/拒绝),就返回一个失败的 promise 和AggregateError类型的实例。 |
Member
There was a problem hiding this comment.
a special error object that stores all promise errors in its errors property.
原文这里也需要同步一下翻译。
另外所有 promise 都失败这里建议直接翻译为 promise 返回一个 AggregateError 类型的错误实例。
Member
There was a problem hiding this comment.
就返回那个已经成功的 promise 。
这里多了一个空格,全角标点之前的英文就不建议加空格了。
|
Please make the requested changes. After it, add a comment "/done". |
Member
|
related issue: #1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目标章节:例如 1-js/01-getting-started/1-intro
当前上游最新 commit:此处填写本项目英文版 https://github.com/javascript-tutorial/en.javascript.info 的最新 commit,例如 b03ca00
本 PR 所做更改如下: