KABA-CCEAC / angular.CQRS

AngularJS module to provide CQRS integration on clientside
18 stars 3 forks source link

It would be nice, if CQRS.sendCommand would return a promise #4

Closed xeronimus closed 9 years ago

xeronimus commented 10 years ago

In some controllers, you want to send multiple commands simultaneously and do something if all of them "returned an event".


 var promiseOne = CQRS.sendCommand({
          command: 'move',
          payload: {attribute: 'one'}
        });

 var promiseTwo = CQRS.sendCommand({
          command: 'hop',
          payload: {attribute: 'two'}
        });

$q.all([promiseOne,promiseTwo]).then(function(){
// received matching events for both commands!
});