From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../onunhandledrejection/index.html | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html (limited to 'files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html') diff --git a/files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html b/files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html new file mode 100644 index 0000000000..5c4f100cec --- /dev/null +++ b/files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html @@ -0,0 +1,57 @@ +--- +title: WindowEventHandlers.onunhandledrejection +slug: Web/API/WindowEventHandlers/onunhandledrejection +tags: + - API + - Event Handler + - HTML DOM + - Promises + - Property + - Reference + - WindowEventHandlers + - events + - onunhandledrejection +translation_of: Web/API/WindowEventHandlers/onunhandledrejection +--- +
{{APIRef}}
+ +

{{domxref("WindowEventHandlers")}} ミックスインの onunhandledrejection プロパティは、{{event("unhandledrejection")}} イベントを処理するための {{domxref("EventHandler")}} です。 このイベントは、処理されなかった {{jsxref("Promise")}} 拒否に対して発生します。

+ +

構文

+ +
window.onunhandledrejection = function;
+ +

+ +

function は、ウィンドウが unhandledrejection イベントを受け取ったときに呼び出す {{domxref("EventHandler")}} または関数です。 イベントハンドラは、{{domxref("PromiseRejectionEvent")}} を入力パラメーターとして受け取ります。

+ +

+ +

この例では、処理されなかった拒否の reason 値を単にコンソールに記録します。

+ +
window.onunhandledrejection = function(e) {
+  console.log(e.reason);
+}
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onunhandledrejection', 'onunhandledrejection')}}{{Spec2('HTML WHATWG')}}初期定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.WindowEventHandlers.onunhandledrejection")}}

-- cgit v1.2.3-54-g00ecf