A few months ago, I blogged about hacking V8 to add support for await. Since then, V8 has finally gotten around to adding native support for generators/yield.

Rewriting await on top of yield has proven to be extremely easy. Roughly 130 lines of code over the course of a couple hours. Whereas, the original implementation I did over a year ago took 1600 lines of code over the course of several weeks.

The "await" keyword works with legacy synchronous functions that take a final callback argument:

And the "await*" keyword works with new generator functions:

The code is up on my fork on Github for anyone to grab. Enjoy!

Hacking V8 Redux: 'await' in node.js<p><center><img alt="" src="/post-content/yield-await-v8/borat.jpg"/></center></p><p><a href="/post/await-again" title="Read more of Hacking V8 Redux: 'await' in node.js">read more</a></p>