aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/generatorfunction
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/generatorfunction
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/generatorfunction')
-rw-r--r--files/de/web/javascript/reference/global_objects/generatorfunction/index.html115
-rw-r--r--files/de/web/javascript/reference/global_objects/generatorfunction/prototype/index.html66
2 files changed, 181 insertions, 0 deletions
diff --git a/files/de/web/javascript/reference/global_objects/generatorfunction/index.html b/files/de/web/javascript/reference/global_objects/generatorfunction/index.html
new file mode 100644
index 0000000000..717774e10f
--- /dev/null
+++ b/files/de/web/javascript/reference/global_objects/generatorfunction/index.html
@@ -0,0 +1,115 @@
+---
+title: GeneratorFunction
+slug: Web/JavaScript/Reference/Global_Objects/GeneratorFunction
+tags:
+ - Constructor
+ - ECMAScript 2015
+ - GeneratorFunction
+ - Iterator
+ - JavaScript
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/GeneratorFunction
+---
+<div>{{JSRef}}</div>
+
+<p>Der <strong><code>GeneratorFunction</code> Konstruktor</strong> erstellt eine neues {{jsxref("Statements/function*", "Generator Funktion")}} Objekt. aktuell ist in JavaScript jede Generatorfunktion ein <code>GeneratorFunction</code> Objekt.</p>
+
+<p>Zu beachten ist, dass <code>GeneratorFunction</code> kein globales Objekt ist. Es kann mit folgendem Quelltext erhalten werden.</p>
+
+<pre class="brush: js">Object.getPrototypeOf(function*(){}).constructor
+</pre>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox"><code>new GeneratorFunction ([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</code></pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
+ <dd>Namen für Formale Argumente der Funktion. Jeder muss ein String sein, der mit einem validen JavaScript-Bezeichner korrespondiert oder eine liste von solchen String, 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 Statements für die Funktionsdefinition enthält.</dd>
+</dl>
+
+<h2 id="Beschreibung">Beschreibung</h2>
+
+<p>{{jsxref("Statements/function*", "Generator Funktion")}} Objekte, die mit dem <code>GeneratorFunction</code> Konstruktor erstellt werden übersetzt, wenn die Funktion erstellt wird. Das ist weniger effizient als die Erstellung mit einer {{jsxref("Statements/function*", "function* Ausdruck")}} und Aufrufe im Quelltext, weil solche Funktionen dem dem Rest des Quelltextes übersetzt werden.</p>
+
+<p>Alle Argumente, die der Funktion übergeben werden, werden als Namen der Bezeichner behandelt und werden als Parameter der Funktion übergen. Die Reihenfolge ist die angegebene Reihenfolge.</p>
+
+<div class="note">
+<p><strong>Hinweis:</strong> {{jsxref("Statements/function*", "Generator Function")}}, die mit dem <code>GeneratorFunction</code> Konstruktor erstellt werden erstellen keine Closures im Erstellungskontext. Sie werden immer im globalen Sichtbarkeitsbereich erstellt. Wenn diese ausgeführt werden, haben sie nur Zugriff auf eigene lokale Variablen und globale Variablen, jedoch nicht auf Variablen des Scopes, in der <code>GeneratorFunction</code> Konstruktor aufgerufen wird. Dieses unterscheidet diese Methode von {{jsxref("Global_Objects/eval", "eval")}} mit dem Quelltext einer Generatorfunktion.</p>
+</div>
+
+<p>Das Aufrufen des <code>GeneratorFunction</code> Konstruktors als Funktion (ohne Einsatz des <code>new</code> Operator) hat den selben Effekt wie beim Aufruf als Konstruktor.</p>
+
+<h2 id="Eigenschaften">Eigenschaften</h2>
+
+<dl>
+ <dt><code><strong>GeneratorFunction.length</strong></code></dt>
+ <dd>Die Länge des <code>GeneratorFunction</code> Konstruktor Eigenschaft, welche 1 ist.</dd>
+ <dt>{{jsxref("GeneratorFunction.prototype")}}</dt>
+ <dd>Erlaubt das Hinzufügen von Eingenschaften für alle Generatorfunktionsobjekte.</dd>
+</dl>
+
+<h2 id="GeneratorFunction_Prototyp_Objekt"><code>GeneratorFunction</code> Prototyp Objekt</h2>
+
+<h3 id="Eigenschaften_2">Eigenschaften</h3>
+
+<div>{{page('/de/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction/prototype', 'Eigenschaften')}}</div>
+
+<h2 id="GeneratorFunction_Instanzen"><code>GeneratorFunction</code> Instanzen</h2>
+
+<p><code>GeneratorFunction</code> Instanzen erben Methoden und Eigenschaften von {{jsxref("GeneratorFunction.prototype")}}. Wie bei allen Konstruktoren, kann man das Konstruktor Prototyp Objekt ändern, um diese für alle<code> GeneratorFunction</code> Instanzen zu übernehmen.</p>
+
+<h2 id="Beispiele">Beispiele</h2>
+
+<h3 id="Erstellen_einer_Generatorfunktion_mit_einem_GeneratorFunction_Konstruktor">Erstellen einer Generatorfunktion mit einem <code>GeneratorFunction</code> Konstruktor</h3>
+
+<pre class="brush: js">var GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor
+var g = new GeneratorFunction('a', 'yield a * 2');
+var iterator = g(10);
+console.log(iterator.next().value); // 20
+</pre>
+
+<h2 id="Spezifikationen">Spezifikationen</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Spezifikation</th>
+ <th scope="col">Status</th>
+ <th scope="col">Kommentar</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-generatorfunction-objects', 'GeneratorFunction')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initiale Definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-generatorfunction-objects', 'GeneratorFunction')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.GeneratorFunction")}}</p>
+</div>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li>{{jsxref("Statements/function*", "function* function")}}</li>
+ <li>{{jsxref("Operators/function*", "function* Ausdruck")}}</li>
+ <li>{{jsxref("Global_Objects/Function", "Function")}}</li>
+ <li>{{jsxref("Statements/function", "function Statement")}}</li>
+ <li>{{jsxref("Operators/function", "function Ausdruck")}}</li>
+ <li>{{jsxref("Functions_and_function_scope", "Funktionen und Sichtbarkeiten", "", 1)}}</li>
+</ul>
diff --git a/files/de/web/javascript/reference/global_objects/generatorfunction/prototype/index.html b/files/de/web/javascript/reference/global_objects/generatorfunction/prototype/index.html
new file mode 100644
index 0000000000..d4e895ed9c
--- /dev/null
+++ b/files/de/web/javascript/reference/global_objects/generatorfunction/prototype/index.html
@@ -0,0 +1,66 @@
+---
+title: GeneratorFunction.prototype
+slug: Web/JavaScript/Reference/Global_Objects/GeneratorFunction/prototype
+tags:
+ - ECMAScript 2015
+ - GeneratorFunction
+ - Iterator
+ - JavaScript
+ - Property
+ - Prototype
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/GeneratorFunction
+---
+<div>{{JSRef}}</div>
+
+<p>Die <code><strong>GeneratorFunction.prototype</strong></code> Eigenschaft repräsentiert den Prototypen des {{jsxref("GeneratorFunction")}} Objektes.</p>
+
+<h2 id="Beschreibung">Beschreibung</h2>
+
+<p>{{jsxref("GeneratorFunction")}} Objekt erbt von <code>GeneratorFunction.prototype</code>. <code>GeneratorFunction.prototype</code> kann nicht verändert werden.</p>
+
+<h2 id="Eigenschaften">Eigenschaften</h2>
+
+<dl>
+ <dt><code><strong>GeneratorFunction.constructor</strong></code></dt>
+ <dd>Der initiale Wert von {{jsxref("GeneratorFunction")}}.</dd>
+ <dt><code><strong>GeneratorFunction.prototype.prototype</strong></code></dt>
+ <dd>Der Wert ist <code>%GeneratorPrototype%</code>.</dd>
+</dl>
+
+<h2 id="Spezifikationen">Spezifikationen</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Spezifikation</th>
+ <th scope="col">Status</th>
+ <th scope="col">Kommentar</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES2015', '#sec-generatorfunction.prototype', 'GeneratorFunction.prototype')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initiale Definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-generatorfunction.prototype', 'GeneratorFunction.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.GeneratorFunction.prototype")}}</p>
+</div>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li>{{jsxref("GeneratorFunction")}}</li>
+ <li>{{jsxref("Function")}}</li>
+</ul>