WindowEventHandlers
ミックスインの onunhandledrejection
プロパティは、unhandledrejection
イベントを処理するための EventHandler
です。 このイベントは、処理されなかった Promise
拒否に対して発生します。
構文
window.onunhandledrejection = function;
値
function
は、ウィンドウが unhandledrejection
イベントを受け取ったときに呼び出す EventHandler
または関数です。 イベントハンドラは、PromiseRejectionEvent
を入力パラメーターとして受け取ります。
例
この例では、処理されなかった拒否の reason
値を単にコンソールに記録します。
window.onunhandledrejection = function(e) {
console.log(e.reason);
}
仕様
仕様 | 状態 | コメント |
---|---|---|
HTML Living Standard onunhandledrejection の定義 |
現行の標準 | 初期定義 |
ブラウザーの互換性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.