AsyncFunction
AsyncFunction オブジェクトは、非同期関数のメソッドを提供します。JavaScript では、すべての非同期関数が実際に AsyncFunction オブジェクトです。
AsyncFunction はグローバルオブジェクトではないことに注意してください。これは以下のようなコードで取得することができます。
js
const AsyncFunction = async function () {}.constructor;
AsyncFunction は Function のサブクラスです。
コンストラクター
AsyncFunction()-
新しい
AsyncFunctionオブジェクトを生成します。
インスタンスプロパティ
インスタンスプロパティを親である Function から継承しています。
これらのプロパティは AsyncFunction.prototype で定義されており、すべての AsyncFunction のインスタンスで共有されます。
AsyncFunction.prototype.constructor-
インスタンスオブジェクトを作成したコンストラクター関数。
AsyncFunctionインスタンスの場合、初期値はAsyncFunctionコンストラクターです。 AsyncFunction.prototype[@@toStringTag]-
@@toStringTagプロパティの初期値は、文字列"AsyncFunction"です。このプロパティはObject.prototype.toString()で使用されます。
メモ: AsyncFunction のインスタンスには prototype プロパティがありません。
インスタンスメソッド
インスタンスメソッドを親である Function から継承しています。
仕様書
| Specification |
|---|
| ECMAScript Language Specification # sec-async-function-objects |
ブラウザーの互換性
BCD tables only load in the browser