Asynchronous iteration
Modules
Built-ins signatures
class Symbol {
static asyncIterator: @@asyncIterator;
}
Entry points
core-js/proposals/async-iteration
core-js(-pure)/es|stable|actual|full/symbol/async-iterator
Examples
const iterable = {
[Symbol.asyncIterator]() {
let i = 0;
return {
next: async () => ({ done: i >= 2, value: i++ }),
};
},
};
for await (const value of iterable) console.log(value); // -> 0, 1