News for hackers. Stuff that matters.
Re:ES6 Overview in Bullet Points by heifer2822 on Friday November 27, 2015 @01:59PM (#10638402)
checkout Koa to see a great use case of generators. By yielding to asychronous code (instead of callbacks) you can write JS that looks like it's synchronous.
Re:ES6 Overview in Bullet Points by NikolaeVarius on Friday November 27, 2015 @03:23PM (#10638714)
What is the advantage of using generators versus promises?
Re:ES6 Overview in Bullet Points by chowes on Friday November 27, 2015 @04:13PM (#10638872)
http://stackoverflow.com/a/28032438 gives a great overview to the pros and cons of both approaches.
Re:ES6 Overview in Bullet Points by callahad on Friday November 27, 2015 @03:51PM (#10638783)
In this case, Koa uses generators and promises together to emulate the behavior of async/await style concurrency. You can see how Babel 5.x transforms ES7 async/await into generators and promises at https://github.com/babel/babel/blob/v5.8.34/packages/babel/s...