AsyncGeneratorFunction
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Das Objekt AsyncGeneratorFunction bietet Methoden für asynchrone Generatorfunktionen. In JavaScript ist jede asynchrone Generatorfunktion tatsächlich ein AsyncGeneratorFunction Objekt.
Beachten Sie, dass AsyncGeneratorFunction kein globales Objekt ist. Es kann mit folgendem Code erhalten werden:
const AsyncGeneratorFunction = async function* () {}.constructor;
AsyncGeneratorFunction ist eine Unterklasse von Function.
Probieren Sie es aus
Konstruktor
AsyncGeneratorFunction()-
Erstellt ein neues
AsyncGeneratorFunctionObjekt.
Instanz-Eigenschaften
Erbt auch Instanz-Eigenschaften von seinem Elternteil Function.
Diese Eigenschaften sind auf AsyncGeneratorFunction.prototype definiert und werden von allen AsyncGeneratorFunction Instanzen geteilt.
AsyncGeneratorFunction.prototype.constructor-
Die Konstruktorfunktion, die das Instanzobjekt erstellt hat. Für
AsyncGeneratorFunctionInstanzen ist der Anfangswert derAsyncGeneratorFunctionKonstruktor. AsyncGeneratorFunction.prototype.prototype-
Alle asynchronen Generatorfunktionen teilen die gleiche
prototypeEigenschaft, welcheAsyncGenerator.prototypeist. Jede asynchrone Generatorfunktion, die mit derasync function*Syntax oder demAsyncGeneratorFunction()Konstruktor erstellt wird, hat auch ihre eigeneprototypeEigenschaft, deren PrototypAsyncGeneratorFunction.prototype.prototypeist. Wenn die asynchrone Generatorfunktion aufgerufen wird, wird ihreprototypeEigenschaft der Prototyp des zurückgegebenen asynchronen Generatorobjekts. AsyncGeneratorFunction.prototype[Symbol.toStringTag]-
Der Anfangswert der
[Symbol.toStringTag]Eigenschaft ist der String"AsyncGeneratorFunction". Diese Eigenschaft wird inObject.prototype.toString()verwendet.
Diese Eigenschaften sind eigene Eigenschaften jeder AsyncGeneratorFunction Instanz.
Instanz-Methoden
Erbt Instanz-Methoden von seinem Elternteil Function.
Spezifikationen
| Specification |
|---|
| ECMAScript Language Specification # sec-asyncgeneratorfunction-objects |
Browser-Kompatibilität
BCD tables only load in the browser