Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add promise.any#1001

Merged
leviding merged 3 commits into
javascript-tutorial:masterjavascript-tutorial/zh.javascript.info:masterfrom
fanerge:masterfanerge/zh.javascript.info:masterCopy head branch name to clipboard
Feb 4, 2022
Merged

feat: add promise.any#1001
leviding merged 3 commits into
javascript-tutorial:masterjavascript-tutorial/zh.javascript.info:masterfrom
fanerge:masterfanerge/zh.javascript.info:masterCopy head branch name to clipboard

Conversation

@fanerge

@fanerge fanerge commented Jan 26, 2022

Copy link
Copy Markdown
Contributor

目标章节:例如 1-js/01-getting-started/1-intro

当前上游最新 commit:此处填写本项目英文版 https://github.com/javascript-tutorial/en.javascript.info 的最新 commit,例如 b03ca00

本 PR 所做更改如下:

文件名 参考上游 commit 更改(原因)
article.md Promise 缺少 any 静态方法

注意,参考上游 commit 是指你所修改的文件,在英文仓库中同名文件的对应 commit,即你此次提交的修改的依据。如果本 PR 你只是提交一个文字或者语句优化,并非根据上游英文仓库的修改而提交的更新,则请填无。

@CLAassistant

CLAassistant commented Jan 26, 2022

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread 1-js/11-async/05-promise-api/article.md Outdated
这里第一个 promise 最快,所以它变成了结果。第一个 settled 的 promise “赢得了比赛”之后,所有进一步的 result/error 都会被忽略。

## Promise.any
与 `Promise.race` 类似,区别在于只要其中的一个 promise 成功,就返回那个已经成功的 promise 。如果可迭代对象中没有一个 promise 成功(即所有的 promises 都失败/拒绝),就返回一个失败的 promise 和AggregateError类型的实例。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a special error object that stores all promise errors in its errors property.

原文这里也需要同步一下翻译。

另外所有 promise 都失败这里建议直接翻译为 promise 返回一个 AggregateError 类型的错误实例。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就返回那个已经成功的 promise 。

这里多了一个空格,全角标点之前的英文就不建议加空格了。

@javascript-translate-bot

Copy link
Copy Markdown

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@songhn233

Copy link
Copy Markdown
Member

related issue: #1000

@leviding leviding merged commit bba4b3d into javascript-tutorial:master Feb 4, 2022
@leviding leviding changed the title pr issues/1000 feat: add promise.any feat: add promise.any Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.