You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This method performs the following steps when called:</p>
59
-
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iterated</var> be the <emu-xref href="#sec-iterator-records"><a href="https://tc39.es/ecma262/#sec-iterator-records">Iterator Record</a></emu-xref> { <var class="field">[[Iterator]]</var>: <var>O</var>, <var class="field">[[NextMethod]]</var>: <emu-val>undefined</emu-val>, <var class="field">[[Done]]</var>: <emu-val>false</emu-val> }.</li><li>If <var>windowSize</var> is not an <emu-xref href="#integral-number"><a href="https://tc39.es/ecma262/#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval"><a href="https://tc39.es/ecma262/#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>1</emu-val><sub>𝔽</sub> to <emu-xref aoid="𝔽"><a href="https://tc39.es/ecma262/#𝔽">𝔽</a></emu-xref>(2<sup>32</sup> - 1), then<ol><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion"><a href="https://tc39.es/ecma262/#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>RangeError</emu-val> object).</li><li>Return ? <emu-xref aoid="IteratorClose"><a href="https://tc39.es/ecma262/#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iterated</var>, <var>error</var>).</li></ol></li><li>Set <var>iterated</var> to ? <emu-xref aoid="GetIteratorDirect"><a href="https://tc39.es/ecma262/#sec-getiteratordirect" class="e-user-code">GetIteratorDirect</a></emu-xref>(<var>O</var>).</li><li>Let <var>closure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>iterated</var> and <var>windowSize</var> and performs the following steps when called:<ol><li>Let <var>buffer</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Repeat,<ol><li>Let <var>value</var> be ? <emu-xref aoid="IteratorStepValue"><a href="https://tc39.es/ecma262/#sec-iteratorstepvalue" class="e-user-code">IteratorStepValue</a></emu-xref>(<var>iterated</var>).</li><li>If <var>value</var> is <emu-const>done</emu-const>, then<ol><li>If <var>buffer</var> is not empty and the number of elements in <var>buffer</var> < <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), perform ? <emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>)).</li><li>Return <emu-xref aoid="ReturnCompletion"><a href="https://tc39.es/ecma262/#sec-returncompletion">ReturnCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li></ol></li><li>Append <var>value</var> to <var>buffer</var>.</li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>))).</li><li><emu-xref aoid="IfAbruptCloseIterator"><a href="https://tc39.es/ecma262/#sec-ifabruptcloseiterator" class="e-user-code">IfAbruptCloseIterator</a></emu-xref>(<var>completion</var>, <var>iterated</var>).</li><li>Remove the first element from <var>buffer</var>.</li></ol></li></ol></li></ol></li><li>Let <var>result</var> be <emu-xref aoid="CreateIteratorFromClosure"><a href="https://tc39.es/ecma262/#sec-createiteratorfromclosure">CreateIteratorFromClosure</a></emu-xref>(<var>closure</var>, <emu-val>"Iterator Helper"</emu-val>, <emu-xref href="#sec-%iteratorhelperprototype%-object"><a href="https://tc39.es/ecma262/#sec-%iteratorhelperprototype%-object">%IteratorHelperPrototype%</a></emu-xref>, « <var class="field">[[UnderlyingIterators]]</var> »).</li><li>Set <var>result</var>.<var class="field">[[UnderlyingIterators]]</var> to « <var>iterated</var> ».</li><li>Return <var>result</var>.</li></ol></emu-alg>
59
+
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iterated</var> be the <emu-xref href="#sec-iterator-records"><a href="https://tc39.es/ecma262/#sec-iterator-records">Iterator Record</a></emu-xref> { <var class="field">[[Iterator]]</var>: <var>O</var>, <var class="field">[[NextMethod]]</var>: <emu-val>undefined</emu-val>, <var class="field">[[Done]]</var>: <emu-val>false</emu-val> }.</li><li>If <var>windowSize</var> is not an <emu-xref href="#integral-number"><a href="https://tc39.es/ecma262/#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval"><a href="https://tc39.es/ecma262/#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>1</emu-val><sub>𝔽</sub> to <emu-xref aoid="𝔽"><a href="https://tc39.es/ecma262/#𝔽">𝔽</a></emu-xref>(2<sup>32</sup> - 1), then<ol><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion"><a href="https://tc39.es/ecma262/#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>RangeError</emu-val> object).</li><li>Return ? <emu-xref aoid="IteratorClose"><a href="https://tc39.es/ecma262/#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iterated</var>, <var>error</var>).</li></ol></li><li>Set <var>iterated</var> to ? <emu-xref aoid="GetIteratorDirect"><a href="https://tc39.es/ecma262/#sec-getiteratordirect" class="e-user-code">GetIteratorDirect</a></emu-xref>(<var>O</var>).</li><li>Let <var>closure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>iterated</var> and <var>windowSize</var> and performs the following steps when called:<ol><li>Let <var>buffer</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Repeat,<ol><li>Let <var>value</var> be ? <emu-xref aoid="IteratorStepValue"><a href="https://tc39.es/ecma262/#sec-iteratorstepvalue" class="e-user-code">IteratorStepValue</a></emu-xref>(<var>iterated</var>).</li><li>If <var>value</var> is <emu-const>done</emu-const>, then<ol><li>If <var>buffer</var> is not empty and the number of elements in <var>buffer</var> < <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Perform <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>))).</li></ol></li><li>Return <emu-xref aoid="ReturnCompletion"><a href="https://tc39.es/ecma262/#sec-returncompletion">ReturnCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li></ol></li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Remove the first element from <var>buffer</var>.</li></ol></li><li>Append <var>value</var> to <var>buffer</var>.</li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>))).</li><li><emu-xref aoid="IfAbruptCloseIterator"><a href="https://tc39.es/ecma262/#sec-ifabruptcloseiterator" class="e-user-code">IfAbruptCloseIterator</a></emu-xref>(<var>completion</var>, <var>iterated</var>).</li></ol></li></ol></li></ol></li><li>Let <var>result</var> be <emu-xref aoid="CreateIteratorFromClosure"><a href="https://tc39.es/ecma262/#sec-createiteratorfromclosure">CreateIteratorFromClosure</a></emu-xref>(<var>closure</var>, <emu-val>"Iterator Helper"</emu-val>, <emu-xref href="#sec-%iteratorhelperprototype%-object"><a href="https://tc39.es/ecma262/#sec-%iteratorhelperprototype%-object">%IteratorHelperPrototype%</a></emu-xref>, « <var class="field">[[UnderlyingIterators]]</var> »).</li><li>Set <var>result</var>.<var class="field">[[UnderlyingIterators]]</var> to « <var>iterated</var> ».</li><li>Return <var>result</var>.</li></ol></emu-alg>
<p>This method performs the following steps when called:</p>
65
-
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iterated</var> be the <emu-xref href="#sec-iterator-records"><a href="https://tc39.es/ecma262/#sec-iterator-records">Iterator Record</a></emu-xref> { <var class="field">[[Iterator]]</var>: <var>O</var>, <var class="field">[[NextMethod]]</var>: <emu-val>undefined</emu-val>, <var class="field">[[Done]]</var>: <emu-val>false</emu-val> }.</li><li>If <var>windowSize</var> is not an <emu-xref href="#integral-number"><a href="https://tc39.es/ecma262/#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval"><a href="https://tc39.es/ecma262/#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>1</emu-val><sub>𝔽</sub> to <emu-xref aoid="𝔽"><a href="https://tc39.es/ecma262/#𝔽">𝔽</a></emu-xref>(2<sup>32</sup> - 1), then<ol><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion"><a href="https://tc39.es/ecma262/#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>RangeError</emu-val> object).</li><li>Return ? <emu-xref aoid="IteratorClose"><a href="https://tc39.es/ecma262/#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iterated</var>, <var>error</var>).</li></ol></li><li>Set <var>iterated</var> to ? <emu-xref aoid="GetIteratorDirect"><a href="https://tc39.es/ecma262/#sec-getiteratordirect" class="e-user-code">GetIteratorDirect</a></emu-xref>(<var>O</var>).</li><li>Let <var>closure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>iterated</var> and <var>windowSize</var> and performs the following steps when called:<ol><li>Let <var>buffer</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Repeat,<ol><li>Let <var>value</var> be ? <emu-xref aoid="IteratorStepValue"><a href="https://tc39.es/ecma262/#sec-iteratorstepvalue" class="e-user-code">IteratorStepValue</a></emu-xref>(<var>iterated</var>).</li><li>If <var>value</var> is <emu-const>done</emu-const>, return <emu-xref aoid="ReturnCompletion"><a href="https://tc39.es/ecma262/#sec-returncompletion">ReturnCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li><li>Append <var>value</var> to <var>buffer</var>.</li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>))).</li><li><emu-xref aoid="IfAbruptCloseIterator"><a href="https://tc39.es/ecma262/#sec-ifabruptcloseiterator" class="e-user-code">IfAbruptCloseIterator</a></emu-xref>(<var>completion</var>, <var>iterated</var>).</li><li>Remove the first element from <var>buffer</var>.</li></ol></li></ol></li></ol></li><li>Let <var>result</var> be <emu-xref aoid="CreateIteratorFromClosure"><a href="https://tc39.es/ecma262/#sec-createiteratorfromclosure">CreateIteratorFromClosure</a></emu-xref>(<var>closure</var>, <emu-val>"Iterator Helper"</emu-val>, <emu-xref href="#sec-%iteratorhelperprototype%-object"><a href="https://tc39.es/ecma262/#sec-%iteratorhelperprototype%-object">%IteratorHelperPrototype%</a></emu-xref>, « <var class="field">[[UnderlyingIterators]]</var> »).</li><li>Set <var>result</var>.<var class="field">[[UnderlyingIterators]]</var> to « <var>iterated</var> ».</li><li>Return <var>result</var>.</li></ol></emu-alg>
65
+
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type"><a href="https://tc39.es/ecma262/#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iterated</var> be the <emu-xref href="#sec-iterator-records"><a href="https://tc39.es/ecma262/#sec-iterator-records">Iterator Record</a></emu-xref> { <var class="field">[[Iterator]]</var>: <var>O</var>, <var class="field">[[NextMethod]]</var>: <emu-val>undefined</emu-val>, <var class="field">[[Done]]</var>: <emu-val>false</emu-val> }.</li><li>If <var>windowSize</var> is not an <emu-xref href="#integral-number"><a href="https://tc39.es/ecma262/#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval"><a href="https://tc39.es/ecma262/#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>1</emu-val><sub>𝔽</sub> to <emu-xref aoid="𝔽"><a href="https://tc39.es/ecma262/#𝔽">𝔽</a></emu-xref>(2<sup>32</sup> - 1), then<ol><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion"><a href="https://tc39.es/ecma262/#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>RangeError</emu-val> object).</li><li>Return ? <emu-xref aoid="IteratorClose"><a href="https://tc39.es/ecma262/#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iterated</var>, <var>error</var>).</li></ol></li><li>Set <var>iterated</var> to ? <emu-xref aoid="GetIteratorDirect"><a href="https://tc39.es/ecma262/#sec-getiteratordirect" class="e-user-code">GetIteratorDirect</a></emu-xref>(<var>O</var>).</li><li>Let <var>closure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures <var>iterated</var> and <var>windowSize</var> and performs the following steps when called:<ol><li>Let <var>buffer</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>Repeat,<ol><li>Let <var>value</var> be ? <emu-xref aoid="IteratorStepValue"><a href="https://tc39.es/ecma262/#sec-iteratorstepvalue" class="e-user-code">IteratorStepValue</a></emu-xref>(<var>iterated</var>).</li><li>If <var>value</var> is <emu-const>done</emu-const>, return <emu-xref aoid="ReturnCompletion"><a href="https://tc39.es/ecma262/#sec-returncompletion">ReturnCompletion</a></emu-xref>(<emu-val>undefined</emu-val>).</li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Remove the first element from <var>buffer</var>.</li></ol></li><li>Append <var>value</var> to <var>buffer</var>.</li><li>If the number of elements in <var>buffer</var> is <emu-xref aoid="ℝ"><a href="https://tc39.es/ecma262/#ℝ">ℝ</a></emu-xref>(<var>windowSize</var>), then<ol><li>Let <var>completion</var> be <emu-xref aoid="Completion"><a href="https://tc39.es/ecma262/#sec-completion-ao">Completion</a></emu-xref>(<emu-xref aoid="Yield"><a href="https://tc39.es/ecma262/#sec-yield" class="e-user-code">Yield</a></emu-xref>(<emu-xref aoid="CreateArrayFromList"><a href="https://tc39.es/ecma262/#sec-createarrayfromlist">CreateArrayFromList</a></emu-xref>(<var>buffer</var>))).</li><li><emu-xref aoid="IfAbruptCloseIterator"><a href="https://tc39.es/ecma262/#sec-ifabruptcloseiterator" class="e-user-code">IfAbruptCloseIterator</a></emu-xref>(<var>completion</var>, <var>iterated</var>).</li></ol></li></ol></li></ol></li><li>Let <var>result</var> be <emu-xref aoid="CreateIteratorFromClosure"><a href="https://tc39.es/ecma262/#sec-createiteratorfromclosure">CreateIteratorFromClosure</a></emu-xref>(<var>closure</var>, <emu-val>"Iterator Helper"</emu-val>, <emu-xref href="#sec-%iteratorhelperprototype%-object"><a href="https://tc39.es/ecma262/#sec-%iteratorhelperprototype%-object">%IteratorHelperPrototype%</a></emu-xref>, « <var class="field">[[UnderlyingIterators]]</var> »).</li><li>Set <var>result</var>.<var class="field">[[UnderlyingIterators]]</var> to « <var>iterated</var> ».</li><li>Return <var>result</var>.</li></ol></emu-alg>
0 commit comments