I am implementing a generator into my logic and it is not clear for me
function *generator {
yield synchronousFunc()
yield asyncFunc()
// should wait till asyncFunc() is completed
// before calling next yield
yield anotherSynchronousFunc()
yield ...
}
how will it work if I convert this generator to async generator with async/await for
for await (const item of generator()) {}
when most of the yields are synchronous.
How async generator will handle the synchronous part of the yields under the hood?
Maybe it is a silly question, but I'm trying to understand how generators works
async-gen"? Is that a runtime library you are using?