documentcloud/backbone — pull request #1359 by timruffles (2012-05-30 13:38:34+00:00)
Title: Group listeners to allow collective removal

Simple implementation of a cross-object grouping for listeners, so they can be removed in one go. Useful in views' `remove` or `destroy` methods to remove all event handlers from multiple subscriptions on models/collections.

Best case now is when you've bound context for every listener `sub.off(null,null,context)`, but you still need as many unbinds as you've objects listened too.

There could be neater implementations out there (sketch below), but just wanted to see if there was any interest in the simpler implementation in this request.

```
Backbone.Event.group("groupName",function() {
subOne.on("news",this.handler)
subTwo.on("other",this.other)
})
Backbone.Event.groupOff("groupName")
```

Thanks