这篇翻译不完整。请帮忙从英语翻译这篇文章

Promise 被reject并且没有得到处理的时候,会触发unhandledrejection事件。
Bubbles No
Cancelable No
Target objects defaultView
Interface PromiseRejectionEvent

继承

unhandledrejection继承自PromiseRejectionEventPromiseRejectionEvent又继承自Event。因此unhandledrejection含有PromiseRejectionEventEvent的属性和方法

例子

window.addEventListener("unhandledrejection", function (event) {
  console.warn("WARNING: Unhandled promise rejection. Shame on you! Reason: "
               + event.reason);
});

说明

Specification Status Comment
HTML Living Standard Living Standard Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 49 未实现[1] 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现[1] 未实现 未实现 未实现

 

[1] In Firefox, this is implemented but disabled by default. To turn it on, go to about:config and set the dom.promise_rejection_events.enabled pref to true.

参考

文档标签和贡献者

此页面的贡献者: Lie8466, zhaoqize
最后编辑者: Lie8466,