--- 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>