diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/promiserejectionevent | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/api/promiserejectionevent')
4 files changed, 345 insertions, 0 deletions
diff --git a/files/ja/web/api/promiserejectionevent/index.html b/files/ja/web/api/promiserejectionevent/index.html new file mode 100644 index 0000000000..07c35df8a9 --- /dev/null +++ b/files/ja/web/api/promiserejectionevent/index.html @@ -0,0 +1,88 @@ +--- +title: PromiseRejectionEvent +slug: Web/API/PromiseRejectionEvent +tags: + - API + - HTML DOM + - Interface + - JavaScript + - PromiseRejectionEvent + - Promises + - Reference + - events + - イベント +translation_of: Web/API/PromiseRejectionEvent +--- +<div>{{APIRef("HTML DOM")}}</div> + +<p><span class="seoSummary"><strong><code>PromiseRejectionEvent</code></strong> インターフェイスは、 JavaScript の {{jsxref("Promise")}} が拒絶されたときにグローバルスクリプトコンテキストに送信されるイベントを表します。</span>これらのイベントは、測定やデバッグ目的に使用すると特に有益です。</p> + +<h2 id="Constructor" name="Constructor">コンストラクター</h2> + +<dl> + <dt>{{domxref("PromiseRejectionEvent.PromiseRejectionEvent", "PromiseRejectionEvent()")}}</dt> + <dd>指定したパラメータで <code>PromiseRejectionEvent</code> イベントを生成する。</dd> +</dl> + +<h2 id="Properties" name="Properties">プロパティ</h2> + +<p><em>親である {{domxref("Event")}} のプロパティも継承しています。</em></p> + +<dl> + <dt>{{domxref("PromiseRejectionEvent.promise")}} {{readonlyInline}}</dt> + <dd>拒絶された JavaScript の {{jsxref("Promise")}}。</dd> + <dt>{{domxref("PromiseRejectionEvent.reason")}} {{readOnlyInline}}</dt> + <dd>{{jsxref("Promise.reject()")}} に渡される Promise が拒絶された理由を示す値、または {{jsxref("Object")}}。</dd> +</dl> + +<h2 id="Methods" name="Methods">メソッド</h2> + +<p><em>このインターフェイスには固有のメソッドはありません。親である {{domxref("Event")}} からメソッドを継承しています。</em></p> + +<h2 id="Events" name="Events">イベント</h2> + +<dl> + <dt>{{Event("rejectionhandled")}}</dt> + <dd>JavaScript の {{jsxref("Promise")}} が拒絶され、promise の reject イベントハンドラーのコードが実行された後に発生する。</dd> + <dt>{{Event("unhandledrejection")}}</dt> + <dd>reject に対するイベントハンドラーがない状態で JavaScript の {{jsxref("Promise")}} が拒絶されたときに発生する。</dd> +</dl> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">window.onunhandledrejection = function(e) { + console.log(e.reason); +}</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + <th scope="col">備考</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#promiserejectionevent', 'PromiseRejectionEvent')}}</td> + <td>{{ Spec2('HTML WHATWG') }}</td> + <td>初回定義</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> + +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("api.PromiseRejectionEvent")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("Promise")}}</li> + <li>{{domxref("WindowEventHandlers.onrejectionhandled")}}</li> + <li>{{domxref("WindowEventHandlers.onunhandledrejection")}}</li> +</ul> diff --git a/files/ja/web/api/promiserejectionevent/promise/index.html b/files/ja/web/api/promiserejectionevent/promise/index.html new file mode 100644 index 0000000000..ae55501f0d --- /dev/null +++ b/files/ja/web/api/promiserejectionevent/promise/index.html @@ -0,0 +1,77 @@ +--- +title: PromiseRejectionEvent.promise +slug: Web/API/PromiseRejectionEvent/promise +tags: + - API + - HTML DOM + - JavaScript + - Promise + - PromiseRejection + - Promises + - Property + - Reference + - events +translation_of: Web/API/PromiseRejectionEvent/promise +--- +<div>{{APIRef("HTML DOM") }}</div> + +<div>{{domxref("PromiseRejectionEvent")}}インターフェイスの読み取り専用プロパティである <code><strong>promise</strong></code> は、拒絶された JavaScript の {{jsxref("Promise")}} を表します。promise が拒絶された理由は、イベントの {{domxref("PromiseRejectionEvent.reason")}} プロパティを検査することでわかります。</div> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox"><em>promise</em> = <em>PromiseRejectionEvent</em>.promise</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>reject(拒絶) されて、処理されていない JavaScript の{{jsxref("Promise")}}。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>この例では処理されておらず、{{domxref("PromiseRejectionEvent.reason", "reason")}} の <code>code</code> 項目が "Module not ready"であるオブジェクトである Promise をリッスンし、正しい実行に失敗するタスクを再実行する何もしないコールバックをセットアップします。</p> + +<p>{{domxref("event.preventDefault()")}} は Promise が処理されたことを示すために呼ばれます。</p> + +<pre class="brush: js">window.onunhandledrejection = function(event) { + if (event.reason.code && event.reason.code == "Module not ready") { + window.requestIdleCallback(function(deadline) { + loadModule(event.reason.moduleName) + .then(performStartup); + }); + event.preventDefault(); + } +}</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">コメント</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#dom-promiserejectionevent-promise', 'PromiseRejectionEvent.promise')}}</td> + <td>{{ Spec2('HTML WHATWG') }}</td> + <td>初期定義。</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + + + +<p>{{Compat("api.PromiseRejectionEvent.promise")}}</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<ul> + <li>{{SectionOnPage("/ja/docs/Web/JavaScript/Guide/Using_promises", "Promise rejection events")}}</li> + <li>{{jsxref("Promise")}}</li> + <li>{{domxref("PromiseRejectionEvent")}}</li> + <li>{{event("rejectionhandled")}}</li> + <li>{{event("unhandledrejection")}}</li> +</ul> diff --git a/files/ja/web/api/promiserejectionevent/promiserejectionevent/index.html b/files/ja/web/api/promiserejectionevent/promiserejectionevent/index.html new file mode 100644 index 0000000000..853e7456a6 --- /dev/null +++ b/files/ja/web/api/promiserejectionevent/promiserejectionevent/index.html @@ -0,0 +1,114 @@ +--- +title: PromiseRejectionEvent() +slug: Web/API/PromiseRejectionEvent/PromiseRejectionEvent +tags: + - API + - Constructor + - HTML DOM + - JavaScript + - PromiseRejectionEvent + - Promises + - Reference + - events +translation_of: Web/API/PromiseRejectionEvent/PromiseRejectionEvent +--- +<div>{{APIRef("HTML DOM")}}</div> + +<p><code><strong>PromiseRejectionEvent()</strong></code> コンストラクタは、JavaScript の {{jsxref("Promise")}} が拒絶されたときに発火するイベントを表す {{domxref("PromiseRejectionEvent")}} を新しく生成し返します。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox">new PromiseRejectionEvent(<em>type</em>, { + promise: <em>somePromise</em>, + reason : <em>someValue</em> +}); +</pre> + +<h3 id="パラメータ">パラメータ</h3> + +<p><em><code>PromiseRejectionEvent()</code></em><em> コンストラクタは、{{domxref("Event.Event", "Event()")}} からも引数を継承しています。</em></p> + +<dl> + <dt><code>type</code></dt> + <dd><code>PromiseRejectionEvent</code> の型名を表す文字列。これは大文字小文字を区別し、{{event("rejectionhandled", '"rejectionhandled"')}} か {{event("unhandledrejection", '"unhandledrejection"')}} のいずれかである必要がある。</dd> + <dt><code>promise</code></dt> + <dd>拒絶された {{jsxref("Promise")}}。</dd> + <dt><code>reason</code></dt> + <dd>promise が拒絶された理由を表すいずれかの値、または {{jsxref("Object")}}。</dd> +</dl> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">コメント</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#promiserejectionevent', 'PromiseRejectionEvent()')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>初期定義。</td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザ実装状況">ブラウザ実装状況</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>機能</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>基本サポート</td> + <td>49</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>機能</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>基本サポート</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="関連項目">関連項目</h2> + +<ul> + <li>{{jsxref("Promise")}}</li> + <li>{{domxref("PromiseRejectionEvent")}}</li> +</ul> diff --git a/files/ja/web/api/promiserejectionevent/reason/index.html b/files/ja/web/api/promiserejectionevent/reason/index.html new file mode 100644 index 0000000000..e9f2a2ff51 --- /dev/null +++ b/files/ja/web/api/promiserejectionevent/reason/index.html @@ -0,0 +1,66 @@ +--- +title: PromiseRejectionEvent.reason +slug: Web/API/PromiseRejectionEvent/reason +tags: + - API + - HTML DOM + - JavaScript + - PromiseRejectionEvent + - Promises + - Property + - Reference + - events + - reason +translation_of: Web/API/PromiseRejectionEvent/reason +--- +<p>{{APIRef("HTML DOM")}}</p> + +<p>{{domxref("PromiseRejectionEvent")}}の <strong><code>reason</code></strong> 読み取り専用プロパティは、{{jsxref("Promise.reject()")}} に渡される理由を提供する任意の JavaScript 値、または {{jsxref("Object")}} です。理論的には promise が拒否された理由についての情報を提供します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox"><em>reason</em> = <em>PromiseRejectionEvent</em>.reason</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>なぜ Promise が拒否されたかを理解するのに使う情報を提供する値またはオブジェクト。これはテキスト、リンク、その他ほしいものをつけた、エラーコードからオブジェクトなんでもありえます。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">window.onunhandledrejection = function(e) { + console.log(e.reason); +}</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">コメント</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'webappapis.html#dom-promiserejectionevent-reason', 'PromiseRejectionEvent.reason')}}</td> + <td>{{ Spec2('HTML WHATWG') }}</td> + <td>初期定義。</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + + + +<p>{{Compat("api.PromiseRejectionEvent.reason")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("Promise")}}</li> + <li>{{domxref("PromiseRejectionEvent")}}</li> + <li>{{event("rejectionhandled")}}</li> + <li>{{event("unhandledrejection")}}</li> +</ul> |