ember-learn/ember-jsonapi-docs

refactor promises to async-await

MartinMalinda opened this issue · 6 comments

I think refactoring promises to async await could improve code readability in this scenario.

I've wanted to do this in the past and did some basic refactor of index.js (https://github.com/MartinMalinda/ember-jsonapi-docs/blob/master/index.js) but got distracted by other work back then and did not finish it.

If you think this is a good idea I can send a PR.

Thanks for taking the time to try this out. With LTS the es6 features we use atm work without the need of babel. Debugging transpiled code is probably the other side of this that we'd probably have to consider.

Would love to hear @acorncom's thoughts :)

I googled a bit and it seems like async-await landed in Node 7 but under a feature flag, so it's not production ready yet.

On the other hand, generators are in Node for quite some time and they could be used for basically the same thing, even if the syntax is not that nice.

I personally use async await in all my code at work 😄. Thought of keeping things simple here.

Having this system using async / await sounds great. However while we're making the "big push" I'd suggest we wait on adding niceties like that unless they really help with the code we're building ...

ok, I agree. I can return to this later.

Closed while on hold. Feel free to submit a PR if anyone wants to make this happen.