chaplinjs/chaplin — pull request #789 by albatrocity (2014-04-25 22:18:22+00:00)
Title: Adding declarative bindings for Controllers, Models, Collections, and CollectionViews

`delegateListeners` and `delegateListener` have been moved to the `EventBroker` so that all classes that mix it in can define a `listen` object to define event listeners. The `delegateListeners` method is called in the constructor of Views, Models, Collections, and Controllers. Basically applying chaplinjs/chaplin#419 to the other basic Chaplin classes.

The motivation behind this was so I could do:

```coffee
class ThingController extends Controller
listen:
'saveThing mediator': 'update'

update: (model) ->
model.save
success: =>
@redirectTo 'things'
```

instead of:

```coffee
class ThingController extends Controller
initialize: ->
super
@subscribeTo 'saveThing', @update

update: (model) ->
model.save
success: =>
@redirectTo 'things'
```

I do this a lot and overriding `initialize` was starting to feel dirty :smile: