marionettejs/backbone.marionette — pull request #267 by derickbailey (2012-10-03 03:49:19+00:00)
Title: Adding Commands And Request/Response From Backbone.Wreqr

Recently I extracted Marionette's EventAggregator in to the [Backbone.Wreqr](https://github.com/marionettejs/backbone.wreqr) plugin. Along with the EventAggregator, this plugin provides a basic Command framework and Request/Response framework - all of which are important in creating scalable systems of loosely coupled components.

The dev branch of Marionette is already set up to use Backbone.Wreqr for it's EventAggregator. With this pull request, I want to get feedback on how I've integrated the Commands and RequestResponse object in to Marionette's Application object as well.

This allows simple commands to be registered and executed:

```js
MyApp = new Marionette.Application();

MyApp.commands.register("foo", function(){
console.log("foo was executed");
});

MyApp.execute("foo"); // => outputs "foo was executed" to the console
```

and for simple request/response scenarios to be handled:

```js
MyApp = new Marionette.Application();

MyApp.reqres.register("foo", function(){
return "response to foo request";
});

MyApp.request("foo"); // => returns "response to foo request"
```

There are docs in the pull request which outline a little more detail on the use, as well as point back to the Wreqr plugin for more information.

All feedback is appreciated.