News for hackers. Stuff that matters.
Re:JavaScript Promises: There and back again by domenicd on Tuesday December 17, 2013 @01:30PM (#6922795)
You cannot yield from the global scope; you have to explicitly be inside a generator function. This isn't really a problem in practice except for one-off-scripts, since most modules don't have side effects but instead export functions (possibly generator functions). But for those one-off scripts it is indeed a bit awkward... you could imagine ways to get around it.

You can catch async errors with generators and promises; see e.g. the linked post, or http://jlongster.com/A-Study-on-Solving-Callbacks-with-JavaS...

There are no comments on this comment yet.