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:
-
If you support only browsers with native support, edit your
config/targets
. -
For supporting older browsers, you may also want to edit your
config/targets
, installember-maybe-import-regenerator
and unsetbabel.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!