I just came to the painful realization that generator functions cannot be used with await. Only promises or async functions.
My team built an entire application with all modules consisting of generator functions, with one call to the Co module from the main js file.
Besides going though hundreds of generator function and changing them from function*(...){
to async function(...){
, how else can generators be made to work with async/await?
Makes no sense because yield*/generators and async/await are pretty similar in how they handle flow so I'm wondering how they missed out on having await support generators.
async/await
is not part of ES7. – Actionableasync/await
though curious about patterns where generators were used which caused issues. Can you include an example of a generator function not being able to be used withasync/await
at Question? – Paysonco
and other solutions that hack async/await semantics into generator functions, promises will be treated specially when yielded. – Grochow