Async functions are now a stage 3 proposal of ES7: http://tc39.github.io/ecmascript-asyncawait/
Async functions are now supported via a flag in Edge: https://blogs.windows.com/msedgedev/2015/09/30/asynchronous-code-gets-easier-with-es2016-async-function-support-in-chakra-and-microsoft-edge/
Transpilation is usually to an ES6 generator: https://babeljs.io/docs/plugins/transform-async-to-generator/
FYI, we plan to support this, but it won't happen in Q1 for sure.
:+1:
It's also possible to transpile async/await to Promises like this:
In
async function test() {
await db.destroy();
}
Out
function test() {
return Promise.resolve().then(function () {
return db.destroy();
}).then(function () {});
}
I specifically want the generator method - not promises. It is simply way too easy to swallow exceptions in non-trivial cases. See #1515
Is there are any progress on it?
Btw I am trying to _sell_ Closure Compiler (Google Traceur) to my team and without async/await it's a bit difficult with Babel nowadays :sweat_smile:
@metrofun Thanks, but FYI, Closure and Traceur are two different compilers :)
@Dominator008 My bad, I was sure Closure Compiler uses Traceur under the hood. Just to clarify then, I'm trying to _sell_ Closure Compiler ;)
It _may_ happen this quarter but I make no promises.
This missed the deadline for ES7 (== ES2016), so now the earliest this could be standardized is ES8.
Most helpful comment
It _may_ happen this quarter but I make no promises.