lundi 1 décembre 2014

ES6 generators- are they really an alternative to async/await?


One of the posts in the comments section of this typescript blog post says:



If I have to wait until 2.0 for ES6 generator support, I'm just gonna stick with Traceur. Generators are a big deal, they give you async/await support today using libraries such as Koa, Co, Bluebird, etc.



Async/await keywords would allow applications to retain a logical structure that resembles synchronous code. How would one use a generator to accomplish something similar? For example, how would you use a generator in conjunction with an ajax call to produce synchronous style code that avoids using callbacks?





Aucun commentaire:

Enregistrer un commentaire