From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/promiserejectionevent/index.html | 88 ++++++++++++++++ .../api/promiserejectionevent/promise/index.html | 77 ++++++++++++++ .../promiserejectionevent/index.html | 114 +++++++++++++++++++++ .../api/promiserejectionevent/reason/index.html | 66 ++++++++++++ 4 files changed, 345 insertions(+) create mode 100644 files/ja/web/api/promiserejectionevent/index.html create mode 100644 files/ja/web/api/promiserejectionevent/promise/index.html create mode 100644 files/ja/web/api/promiserejectionevent/promiserejectionevent/index.html create mode 100644 files/ja/web/api/promiserejectionevent/reason/index.html (limited to 'files/ja/web/api/promiserejectionevent') 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 +--- +
{{APIRef("HTML DOM")}}
+ +

PromiseRejectionEvent インターフェイスは、 JavaScript の {{jsxref("Promise")}} が拒絶されたときにグローバルスクリプトコンテキストに送信されるイベントを表します。これらのイベントは、測定やデバッグ目的に使用すると特に有益です。

+ +

コンストラクター

+ +
+
{{domxref("PromiseRejectionEvent.PromiseRejectionEvent", "PromiseRejectionEvent()")}}
+
指定したパラメータで PromiseRejectionEvent イベントを生成する。
+
+ +

プロパティ

+ +

親である {{domxref("Event")}} のプロパティも継承しています。

+ +
+
{{domxref("PromiseRejectionEvent.promise")}} {{readonlyInline}}
+
拒絶された JavaScript の {{jsxref("Promise")}}。
+
{{domxref("PromiseRejectionEvent.reason")}} {{readOnlyInline}}
+
{{jsxref("Promise.reject()")}} に渡される Promise が拒絶された理由を示す値、または {{jsxref("Object")}}。
+
+ +

メソッド

+ +

このインターフェイスには固有のメソッドはありません。親である {{domxref("Event")}} からメソッドを継承しています。

+ +

イベント

+ +
+
{{Event("rejectionhandled")}}
+
JavaScript の {{jsxref("Promise")}} が拒絶され、promise の reject イベントハンドラーのコードが実行された後に発生する。
+
{{Event("unhandledrejection")}}
+
reject に対するイベントハンドラーがない状態で JavaScript の {{jsxref("Promise")}} が拒絶されたときに発生する。
+
+ +

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

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('HTML WHATWG', 'webappapis.html#promiserejectionevent', 'PromiseRejectionEvent')}}{{ Spec2('HTML WHATWG') }}初回定義
+ +

ブラウザーの対応

+ + + +

{{Compat("api.PromiseRejectionEvent")}}

+ +

関連情報

+ + 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 +--- +
{{APIRef("HTML DOM") }}
+ +
{{domxref("PromiseRejectionEvent")}}インターフェイスの読み取り専用プロパティである promise は、拒絶された JavaScript の {{jsxref("Promise")}} を表します。promise が拒絶された理由は、イベントの {{domxref("PromiseRejectionEvent.reason")}} プロパティを検査することでわかります。
+ +

構文

+ +
promise = PromiseRejectionEvent.promise
+ +

+ +

reject(拒絶) されて、処理されていない JavaScript の{{jsxref("Promise")}}。

+ +

+ +

この例では処理されておらず、{{domxref("PromiseRejectionEvent.reason", "reason")}} の code 項目が "Module not ready"であるオブジェクトである Promise をリッスンし、正しい実行に失敗するタスクを再実行する何もしないコールバックをセットアップします。

+ +

{{domxref("event.preventDefault()")}} は Promise が処理されたことを示すために呼ばれます。

+ +
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();
+  }
+}
+ +

仕様

+ + + + + + + + + + + + + + + + +
仕様ステータスコメント
{{SpecName('HTML WHATWG', 'webappapis.html#dom-promiserejectionevent-promise', 'PromiseRejectionEvent.promise')}}{{ Spec2('HTML WHATWG') }}初期定義。
+ +

ブラウザー実装状況

+ + + +

{{Compat("api.PromiseRejectionEvent.promise")}}

+ +

ブラウザー実装状況

+ + 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 +--- +
{{APIRef("HTML DOM")}}
+ +

PromiseRejectionEvent() コンストラクタは、JavaScript の {{jsxref("Promise")}} が拒絶されたときに発火するイベントを表す {{domxref("PromiseRejectionEvent")}} を新しく生成し返します。

+ +

構文

+ +
new PromiseRejectionEvent(type, {
+  promise: somePromise,
+  reason : someValue
+});
+
+ +

パラメータ

+ +

PromiseRejectionEvent() コンストラクタは、{{domxref("Event.Event", "Event()")}} からも引数を継承しています。

+ +
+
type
+
PromiseRejectionEvent の型名を表す文字列。これは大文字小文字を区別し、{{event("rejectionhandled", '"rejectionhandled"')}} か {{event("unhandledrejection", '"unhandledrejection"')}} のいずれかである必要がある。
+
promise
+
拒絶された {{jsxref("Promise")}}。
+
reason
+
promise が拒絶された理由を表すいずれかの値、または {{jsxref("Object")}}。
+
+ +

仕様

+ + + + + + + + + + + + + + + + +
仕様ステータスコメント
{{SpecName('HTML WHATWG', 'webappapis.html#promiserejectionevent', 'PromiseRejectionEvent()')}}{{Spec2('HTML WHATWG')}}初期定義。
+ +

ブラウザ実装状況

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本サポート49{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
機能AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本サポート{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

関連項目

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

{{APIRef("HTML DOM")}}

+ +

{{domxref("PromiseRejectionEvent")}}の reason 読み取り専用プロパティは、{{jsxref("Promise.reject()")}} に渡される理由を提供する任意の JavaScript 値、または {{jsxref("Object")}} です。理論的には promise が拒否された理由についての情報を提供します。

+ +

構文

+ +
reason = PromiseRejectionEvent.reason
+ +

+ +

なぜ Promise が拒否されたかを理解するのに使う情報を提供する値またはオブジェクト。これはテキスト、リンク、その他ほしいものをつけた、エラーコードからオブジェクトなんでもありえます。

+ +

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

仕様

+ + + + + + + + + + + + + + + + +
仕様ステータスコメント
{{SpecName('HTML WHATWG', 'webappapis.html#dom-promiserejectionevent-reason', 'PromiseRejectionEvent.reason')}}{{ Spec2('HTML WHATWG') }}初期定義。
+ +

ブラウザー実装状況

+ + + +

{{Compat("api.PromiseRejectionEvent.reason")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf