aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/asyncfunction
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/de/web/javascript/reference/global_objects/asyncfunction
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/asyncfunction')
-rw-r--r--files/de/web/javascript/reference/global_objects/asyncfunction/index.html124
-rw-r--r--files/de/web/javascript/reference/global_objects/asyncfunction/prototype/index.html61
2 files changed, 185 insertions, 0 deletions
diff --git a/files/de/web/javascript/reference/global_objects/asyncfunction/index.html b/files/de/web/javascript/reference/global_objects/asyncfunction/index.html
new file mode 100644
index 0000000000..994df6d344
--- /dev/null
+++ b/files/de/web/javascript/reference/global_objects/asyncfunction/index.html
@@ -0,0 +1,124 @@
+---
+title: AsyncFunction
+slug: Web/JavaScript/Reference/Global_Objects/AsyncFunction
+tags:
+ - Constructor
+ - Experimental
+ - JavaScript
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/AsyncFunction
+---
+<div>{{JSRef}}</div>
+
+<p>Der <strong><code>AsyncFunction</code> Konstruktor</strong> erstellt ein neues {{jsxref("Statements/async_function", "AsyncFunction")}} Objekt. In JavaScript ist jede asynchrone Funktion ein <code>AsyncFunction</code> Objekt.</p>
+
+<div class="note">
+<p><strong>Hinweis: </strong><code>AsyncFunction</code> ist kein globales Objekt. Durch die ausführung des folgenden Quelltextes kann das Objekte erhalten werden.</p>
+
+<pre class="brush: js">Object.getPrototypeOf(async function(){}).constructor</pre>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">new AsyncFunction([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</pre>
+
+<h3 id="Parameter">Parameter</h3>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>Namen, die für die Namen der formalen Parameter der Funktion verwendet werden. Jeder muss ein String mit einem validen JavaScript-Bezeichner sein oder eine Liste von Strings, welche mit einem Komma getrennt sind; zum Beispiel "<code>x</code>", "<code>theValue</code>", oder "<code>a,b</code>".</dd>
+ <dt><code>functionBody</code></dt>
+ <dd>Ein String, welcher die JavaScript-Anweisungen enthält, welche die Funktion definieren.</dd>
+</dl>
+
+<h2 id="Beschreibung">Beschreibung</h2>
+
+<p>{{jsxref("Statements/async_function", "asyncFunction")}} Objekte, die mit dem <code>AsyncFunction</code> Konstruktor erstellt werden, werden analysieren, wenn sie erstellt werden. Dieses ist weniger effizient als die Deklaration einer asynchronen Funktion mit einem {{jsxref("Statements/async_function", "asyncFunction Ausdruck")}} und dem Aufruf in dem Code, weil solche Funktion mit dem Rest des Quelltextes analysieren werden.</p>
+
+<p><span id="result_box" lang="de"><span>Alle an die Funktion übergebenen Argumente werden als die Namen der Bezeichner der Parameter in der zu erstellenden Funktion in der Reihenfolge behandelt, in der sie übergeben werden.</span></span></p>
+
+<div class="note">
+<p><strong>Hinweis:</strong> Mit dem <code>AsyncFunction</code> Konstruktor erstellte {{jsxref("Statements/async_function", "asyncFunctions")}} erstellen keine Closures in ihrem Erstellungskontext; Sie werden immer im globalen Scope erstellt. Wenn sie ausgeführt werden, haben sie nur Zugriff auf eigene lokale Variablen und globale Variablen, jedoch nicht auf Variablen aus dem Scope, indem der <code>AsyncFunction</code> Konstruktor aufgerufen wurde. Dies ist der Unterschied zum Einsatz von {{jsxref("Global_Objects/eval", "eval")}} mit Quelltext für eine asynchrone Funktionsanweisung.</p>
+</div>
+
+<p>Das Aufrufen des <code>AsyncFunction</code> Konstruktors als Funktion (ohne Einsatz des <code>new</code> Operators) hat den gleichen Effekt wie das Aufrufen als Konstruktor.</p>
+
+<h2 id="Eigenschaften">Eigenschaften</h2>
+
+<dl>
+ <dt><code><strong>AsyncFunction.length</strong></code></dt>
+ <dd>Die <code>AsyncFunction</code> Konstruktor Längeneigenschaft, welche den Wert 1 hat.</dd>
+ <dt>{{jsxref("AsyncFunction.prototype")}}</dt>
+ <dd>Erlaubt das Hinzufügen von Eigenschaften zu allen <code>AsyncFunction</code> Objekten.</dd>
+</dl>
+
+<h2 id="AsyncFunction_Prototype_Objekt"><code>AsyncFunction</code> Prototype Objekt</h2>
+
+<h3 id="Eigenschaften_2">Eigenschaften</h3>
+
+<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction/prototype', 'Eigenschaften')}}</div>
+
+<h2 id="AsyncFunction_Instanzen"><code>AsyncFunction</code> Instanzen</h2>
+
+<p><code>AsyncFunction</code> Instanzen erben Methoden und Eigenschaften von {{jsxref("AsyncFunction.prototype")}}. Wie bei allen Konstruktoren ist es möglich die Eigenschaften des Konstruktor Objektes zu ändern, um Änderungen an allen <code>AsyncFunction</code> Instanzen vorzunehmen.</p>
+
+<h2 id="Beispiele">Beispiele</h2>
+
+<h3 id="Erstellen_einer_asynchronen_Funktion_mit_einem_AsyncFunction_Konstruktor">Erstellen einer asynchronen Funktion mit einem <code>AsyncFunction</code> Konstruktor</h3>
+
+<pre class="brush: js">function resolveAfter2Seconds(x) {
+ return new Promise(resolve =&gt; {
+ setTimeout(() =&gt; {
+ resolve(x);
+ }, 2000);
+ });
+}
+
+var AsyncFunction = Object.getPrototypeOf(async function(){}).constructor
+
+var a = new AsyncFunction('a',
+ 'b',
+ 'return await resolveAfter2Seconds(a) + await resolveAfter2Seconds(b);');
+
+a(10, 20).then(v =&gt; {
+ console.log(v); // prints 30 after 4 seconds
+});
+</pre>
+
+<h2 id="Spezifikationen">Spezifikationen</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Spezifikation</th>
+ <th scope="col">Status</th>
+ <th scope="col">Kommentar</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-objects', 'AsyncFunction object')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Initiale Definition in ES2017.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.AsyncFunction")}}</p>
+</div>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li>{{jsxref("Statements/async_function", "async function function")}}</li>
+ <li>{{jsxref("Operators/async_function", "async function expression")}}</li>
+ <li>{{jsxref("Global_Objects/Function", "Function")}}</li>
+ <li>{{jsxref("Statements/function", "function statement")}}</li>
+ <li>{{jsxref("Operators/function", "function expression")}}</li>
+ <li>{{jsxref("Functions_and_function_scope", "Functions and function scope", "", 1)}}</li>
+</ul>
diff --git a/files/de/web/javascript/reference/global_objects/asyncfunction/prototype/index.html b/files/de/web/javascript/reference/global_objects/asyncfunction/prototype/index.html
new file mode 100644
index 0000000000..2dc516ca5c
--- /dev/null
+++ b/files/de/web/javascript/reference/global_objects/asyncfunction/prototype/index.html
@@ -0,0 +1,61 @@
+---
+title: AsyncFunction.prototype
+slug: Web/JavaScript/Reference/Global_Objects/AsyncFunction/prototype
+tags:
+ - Experimental
+ - JavaScript
+ - Property
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/AsyncFunction/prototype
+---
+<div>{{JSRef}}</div>
+
+<p>Die <code><strong>AsyncFunction.prototype</strong></code> Eigenschaft repräsentiert den Prototypen des {{jsxref("AsyncFunction")}} Objektes.</p>
+
+<h2 id="Beschreibung">Beschreibung</h2>
+
+<p>{{jsxref("AsyncFunction")}} Objekte erben von <code>AsyncFunction.prototype</code>. <code>AsyncFunction.prototype</code> kann nicht verändert werden.</p>
+
+<h2 id="Eigenschaften">Eigenschaften</h2>
+
+<dl>
+ <dt><code><strong>AsyncFunction.constructor</strong></code></dt>
+ <dd>Der Initialwert ist {{jsxref("AsyncFunction")}}.</dd>
+ <dt><code><strong>AsyncFunction.prototype[@@toStringTag]</strong></code></dt>
+ <dd>Gibt <code>"AsyncFunction"</code> zurück.</dd>
+</dl>
+
+<h2 id="Spezifikationen">Spezifikationen</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Spezifikation</th>
+ <th scope="col">Status</th>
+ <th scope="col">Kommentar</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-async-function-constructor-prototype', 'AsyncFunction.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td>Initiale Definition in ES2017.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.AsyncFunction.prototype")}}</p>
+</div>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li>{{jsxref("AsyncFunction")}}</li>
+ <li>{{jsxref("Function")}}</li>
+</ul>