JavaScripture
Contribute via GitHub Feedback

AsyncIterator : AsyncIterable

An AsyncIterator is an Object that returns a sequence of Promises.

Since AsyncIterators are AsyncIterables, you can use for await (const value of iterable) {} to easily loop over the values in an AsyncIterator.

Calling an async generator function (async function* () {}) returns an AsyncIterator.

See AsyncIterable for more details.

Example:

Run

Results:

 

Instance Indexers

Returns a method that returns this.

Example:

Run

Results:

 

Instance Methods

next([yieldValue : Object]) : Promise

Promise return type: { value : Object, done : Boolean }

return([yieldValue : Object]) : Promise

throw([rejectReason : Object]) : Promise