Is it possible to write an asynchronous generator like the following:
function gen() {
return async function * () {
yield await ...
yield await ...
yield await ...
}()
}
So one can use it like this, for example:
for (let val of await gen()) {
...
}
I can't really work out the semantics of this construction, how are async generators used in loops?
fetch.next()or.throw()on the iterator until the promise has completed.