translation/06-async/03-promise-chaining#255
Merged
leviding merged 6 commits intojavascript-tutorial:zh-hansfrom Oct 13, 2018
Merged
translation/06-async/03-promise-chaining#255leviding merged 6 commits intojavascript-tutorial:zh-hansfrom
leviding merged 6 commits intojavascript-tutorial:zh-hansfrom
Conversation
Contributor
Author
|
resolve #242 |
|
@leviding 校对认领 |
calpa
approved these changes
Oct 10, 2018
calpa
left a comment
There was a problem hiding this comment.
写得不错 👍,只是有些地方可以改得再通顺一点,比如说加标点符号,例如:逗号。
| @@ -1,12 +1,12 @@ | |||
| # Promise: then versus catch | |||
| # Promise: then VS catch | |||
| # Promise: then VS catch | ||
|
|
||
| Are these code fragments equal? In other words, do they behave the same way in any circumstances, for any handler functions? | ||
| 这两段代码片段是否相等?换句话说,对于任何处理函数在任何情况下的行为方式是否相同? |
| ``` | ||
|
|
||
| Versus; | ||
| VS; |
| @@ -1,6 +1,6 @@ | |||
| # Error in setTimeout | |||
| # setTimeout 中的 error | |||
| # setTimeout 中的 error | ||
|
|
||
| How do you think, does the `.catch` trigger? Explain your answer? | ||
| 你认为 `.catch` 会不会触发?请解释你的回答? |
| ``` | ||
|
|
||
| Now right after `setTimeout` runs `img.remove()`, it calls `resolve(githubUser)`, thus passing the control to the next `.then` in the chain and passing forward the user data. | ||
| 现在在 `setTimeout` 后运行 `img.remove()`,然后调用 `resolve(githubUser)`,这样链中的控制流程走到下一个 `.then` 并传入用户数据。 |
| 现在在 `setTimeout` 后运行 `img.remove()`,然后调用 `resolve(githubUser)`,这样链中的控制流程走到下一个 `.then` 并传入用户数据。 | ||
|
|
||
| As a rule, an asynchronous action should always return a promise. | ||
| 通常一个异步动作总是需要返回一个 promise。 |
| 通常一个异步动作总是需要返回一个 promise。 | ||
|
|
||
| That makes possible to plan actions after it. Even if we don't plan to extend the chain now, we may need it later. | ||
| 这就让规划下一步动作成为可能。虽然现在我们没打算扩展链,不过我们可能在后面需要它。 |
| ``` | ||
|
|
||
| Or, maybe, everything is all right with the server, but the response is not a valid JSON: | ||
| 或者是,服务器的一切都很好,但响应不是有效的 JSON: |
| ``` | ||
|
|
||
| Here the `.catch` block finishes normally. So the next successful handler is called. Or it could return something, that would be the same. | ||
| 在这里,`.catch` 块正常结束。所以会调用下一个成功处理程序。或者它可以返回一些东西,这和之前的流程相同。 |
There was a problem hiding this comment.
在这里,.catch 块正常结束,然后调用下一个成功处理程序。或者它可以返回一些东西,这和之前的流程相同。
|
@leviding 校对完成 |
Contributor
Author
|
已根据校对建议修改完毕,@calpa 校对地很用心仔细,点赞。 |
calpa
approved these changes
Oct 12, 2018
leviding
approved these changes
Oct 13, 2018
Member
|
校对 4 分,翻译 11 分,辛苦了。 |
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.
翻译完毕,不好意思由于国庆超了几天。