Search completed in 1.52 seconds.
4 results for "AsyncIterator":
Symbol.asyncIterator - JavaScript
WebJavaScriptReferenceGlobal ObjectsSymbolasyncIterator
the symbol.asynciterator well-known symbol specifies the default asynciterator for an object.
... description the symbol.asynciterator symbol is a builtin symbol that is used to access an object's @@asynciterator method.
... in order for an object to be async iterable, it must have a symbol.asynciterator key.
...And 5 more matches
ReadableStream - Web APIs
WebAPIReadableStream
readablestream[@@asynciterator]() alias of getiterator method.
Symbol - JavaScript
WebJavaScriptReferenceGlobal ObjectsSymbol
static properties symbol.asynciterator a method that returns the default asynciterator for an object.
for await...of - JavaScript
WebJavaScriptReferenceStatementsfor-await...of
examples iterating over async iterables you can also iterate over an object that explicitly implements async iterable protocol: const asynciterable = { [symbol.asynciterator]() { return { i: 0, next() { if (this.i < 3) { return promise.resolve({ value: this.i++, done: false }); } return promise.resolve({ done: true }); } }; } }; (async function() { for await (let num of asynciterable) { console.log(num); } })(); // 0 // 1 // 2 iterating over async generators since the return values of asyn...