4 ms·
The parent exaggerated a little. async/await does use promises. In fact, it's built around them. All async functions return promises, and all await expressions
by nvivo 11y ago
The parent exaggerated a little. async/await does use promises. In fact, it's built around them.
All async functions return promises, and all await expressions await on promises. Currently on babel implementation with facebooks's regenarator it seems to work on any "thenable", because I got it working with jquery and angular promises.
- callahad 11y agoDepending on which transforms you enable, you can also eliminate Regenerator and use native ES6 promises and generators. E.g: https://gist.github.com/callahad/b99c83d6d9fd675137b7 https://gist.github.com/callahad/b99c83d6d9fd675137b7 Promises are sufficiently supported in the latest versions of all major browsers, and Generators are almost there. They're supported in Firefox and Chrome, behind a flag in Edge, but unsupported in Safari. But if you're targeting Node 4.0, you might as well transpile down to ES6 instead of going all the way to ES5 and pulling in Regenerator :)