ember-concurrency
"an experience report"
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 2
Slide 2 text
ember-concurrency
ember-concurrency is an Ember Addon that makes it easy to write
concise, robust, and beautiful asynchronous code.
--http://ember-concurrency.com/
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 3
Slide 3 text
tasks and instances
aTask = task(function * () {
const { geolocation, store } = this.get(...);
const coords = yield geolocation.getCoords();
const result = yield store.getNearbyStores(coords);
this.set('result', result);
});
anInstance = someTask.perform();
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 4
Slide 4 text
problems ember-concurrency
solves, easily
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 5
Slide 5 text
mashing the "submit" button on an update
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 6
Slide 6 text
!
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 7
Slide 7 text
concurrency protocols
task(function * () {
// ...
}).drop()
(ember-concurrency calls these "modifiers")
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 8
Slide 8 text
!
Reginald @raganwald Braithwaite, PagerDuty Inc.
Slide 9
Slide 9 text
displaying a loading spinner
Reginald @raganwald Braithwaite, PagerDuty Inc.