I send the controller an event that will result in some long processing/work. Once this work is complete, I want the controller to update a binding. Ideally, I do not want th controller to know anything about this work, I simply want it to ask for the result.
In this example thingApi
is an injected object that knows how to create new strings for things (done async). newString()
is a function that returns a promise that eventually resolves to a string.
What I have to do:
this.get('thingApi').newString().then(function(string) {
this.set('thing', string);
});
What I would like to do (hide the promise from the controller).
this.set('thing', this.get('thingApi').newString());