Can `async` and `await` be used in application code?

The first time, I saw async and await in Ember was on the New Testing API RFC, but I read that async/await can also be used in your application code. @rwjblue wrote about it in a very informative post: An async / await Configuration Adventure.

There are two possible scenarios to use async/await in your application code:

  1. If you support only browsers with native support, edit your config/targets.

  2. For supporting older browsers, you may also want to edit your config/targets, install ember-maybe-import-regenerator and unset babel.includePolyfill .

I recommend reading the whole post, it provides a very good explanation about all the different scenarios and gotchas.

async/await can produce a more concise and clean code in many cases. I have gotten too used to writing Promise chains that it was not obvious that I could start using async/await in my application code.

If you can afford to include the ember-maybe-import-regenerator addon that “may” add the 2kb gzipped dependency, just try them out!