Having the ability to block actions and view events is a common pattern which I need to use in some cases.
I think than actions and view events could be blocked when an action handler returns a promise whose state is pending of resolution.
// route, controllers, components, views
actions: {
purchase: function() {
// Do any async task which blocks
// the execution of other events till its resolution.
// It ensures other actions do not interfere its result
return Ember.RSVP.promise(function(resolve, reject) {
....
// when the promise is fulfilled, the UI unblocks
resolve();
});
}
}
Saving the state of a critical promise lets to manage the dispatch of user interaction events and other system events based on promise resolution.
I have not yet seen any discussion of this use case and would like to know if others find it useful or other possible solutions.