AsyncFunction

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Das AsyncFunction-Objekt bietet Methoden für asynchrone Funktionen. In JavaScript ist jede asynchrone Funktion tatsächlich ein AsyncFunction-Objekt.

Beachten Sie, dass AsyncFunction kein globales Objekt ist. Es kann mit folgendem Code erhalten werden:

js
const AsyncFunction = async function () {}.constructor;

AsyncFunction ist eine Unterklasse von Function.

Konstruktor

AsyncFunction()

Erstellt ein neues AsyncFunction-Objekt.

Instanz-Eigenschaften

Erbt auch Instanz-Eigenschaften von seinem Elternteil Function.

Diese Eigenschaften sind auf AsyncFunction.prototype definiert und werden von allen AsyncFunction-Instanzen geteilt.

AsyncFunction.prototype.constructor

Die Konstruktorfunktion, die das Instanzobjekt erstellt hat. Für AsyncFunction-Instanzen ist der anfängliche Wert der AsyncFunction-Konstruktor.

AsyncFunction.prototype[Symbol.toStringTag]

Der anfängliche Wert der [Symbol.toStringTag]-Eigenschaft ist der String "AsyncFunction". Diese Eigenschaft wird in Object.prototype.toString() verwendet.

Note: AsyncFunction-Instanzen haben nicht die prototype-Eigenschaft.

Instanzmethoden

Erbt Instanzmethoden von seinem Elternteil Function.

Spezifikationen

Specification
ECMAScript® 2026 Language Specification
# sec-async-function-objects

Browser-Kompatibilität

Siehe auch