Skip to content
New issue

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

[zh-cn]: fix mistranslation #25234

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions files/zh-cn/web/javascript/guide/using_promises/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ async function main() {

当一个 Promise 拒绝事件未被任何处理器处理时,它会冒泡到调用栈的顶部,主机需要将其暴露出来。在 Web 上,当 Promise 被拒绝时,会有下文所述的两个事件之一被派发到全局作用域(通常而言,就是 {{domxref("window")}};如果是在 web worker 中使用的话,就是 {{domxref("Worker")}} 或者其他基于 worker 的接口)。这两个事件如下所示:

- {{domxref("Window.rejectionhandled_event", "rejectionhandled")}}
- : 当 Promise 被拒绝、并且在 `reject` 函数处理该拒绝事件之后会派发此事件
- {{domxref("Window.unhandledrejection_event", "unhandledrejection")}}
- : 当 Promise 被拒绝,但没有提供 `reject` 函数来处理该拒绝事件时,会派发此事件。
- [`unhandledrejection`](/zh-CN/docs/Web/API/Window/unhandledrejection_event)
- : 当 promise 被拒绝,但没有可用的拒绝处理器时,会派发此事件
- [`rejectionhandled`](/zh-CN/docs/Web/API/Window/rejectionhandled_event)
- : 当一个被拒绝的 promise 在触发了 `unhandledrejection` 事件之后才附加处理器时,会派发此事件。

上述两种事件(类型为 {{domxref("PromiseRejectionEvent")}})都有两个属性,一个是 {{domxref("PromiseRejectionEvent.promise", "promise")}} 属性,该属性指向被拒绝的 Promise,另一个是 {{domxref("PromiseRejectionEvent.reason", "reason")}} 属性,该属性用来说明 Promise 被拒绝的原因。

Expand Down
Loading