WindowEventHandlers.onunhandledrejection
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