aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/windoweventhandlers/onunhandledrejection/index.html
blob: 15334441cc33579bde5a098e58c98ac0459e9624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
---
<div>{{APIRef}}</div>

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

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="syntaxbox">window.onunhandledrejection = <em>function</em>;</pre>

<h3 id="Value" name="Value"></h3>

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

<h2 id="Examples" name="Examples"></h2>

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

<pre class="brush: js">window.onunhandledrejection = function(e) {
  console.log(e.reason);
}</pre>

<h2 id="Specifications" name="Specifications">仕様</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">仕様</th>
   <th scope="col">状態</th>
   <th scope="col">コメント</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'webappapis.html#handler-window-onunhandledrejection', 'onunhandledrejection')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>初期定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>



<p>{{Compat("api.WindowEventHandlers.onunhandledrejection")}}</p>