#59 Ember Concurrency

Tip

Idea submitted by both Devin Weaver and Austin Burdine.
Tip by Devin Weaver
An alternative community de facto standard is an addon called ember-concurrency that makes a lot of the promise confusion go away.
It can be installed with the command ember install ember-concurrency.
Pros
Intuitive reasoning of complex asynchronous code.
Offers a complete API for managing tasks.
Can be canceled.
Can be used directly in a component without the need of a proxy object.
Destructures promises inside the task function.
Can use JavaScript try / catch / finally blocks to manage asynchronous assignment, exceptions, and cleanup.
Tasks are automagically cancelled on willDestroy event, avoiding errors setting values on destroyed objects (e.g. after a timer)
Cons
Not builtin – requires ember install ember-concurrency
Uses generator functions that can confuse developers used to promise chains.
JavaScript

Template

Credits & Links

Thanks to Austin for the idea and Devin for write up.
ember-concurrency athttp://ember-concurrency.com/#/docs(good documentation, video and examples)
Related:tip #54

Free Programming Books and lifetime access to IconApp.io

I am giving away some programming books and lifetime access to iconapp.io library of awesome icons.  Check it out at https://gleam.io/XqHjW/rock-and-roll-with-emberjs

Share A Tip

Email me at emad@emberdaily.tips if you have a good ember tip.
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know how I can improve them.

Published by

Emad Ibrahim

Author of asp .net MVC & TDD, entrepreneur, passionate technologist, programmer and productivity nut. more at http://t.co/oSJXPvzu