onunhandledrejection
特性为
WindowEventHandlers
混合
EventHandler
为处理
unhandledrejection
events. These events are raised for unhandled
Promise
rejections.
window.onunhandledrejection = function;
function
是
EventHandler
or function to call when
unhandledrejection
events are received by the window. The event handler receives as an input parameter as a
PromiseRejectionEvent
.
This example simply logs unhandled rejections'
reason
values to the console.
window.onunhandledrejection = function(e) {
console.log(e.reason);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'onunhandledrejection' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
onunhandledrejection
|
Chrome 49 | Edge ≤79 |
Firefox
69
|
IE No | Opera 36 | Safari 11 | WebView Android 49 | Chrome Android 49 |
Firefox Android
68
Disabled
|
Opera Android No | Safari iOS 11.3 | Samsung Internet Android 5.0 |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。