Skip to content

Commit

Permalink
Merge pull request #1364 from jmeas/unbindEntityEvents-docs
Browse files Browse the repository at this point in the history
Add docs for unbindEntityEvents
  • Loading branch information
samccone committed May 22, 2014
2 parents 5295822 + 09044c4 commit 999fa5e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/marionette.functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,36 @@ The third parameter is a hash of { "event:name": "eventHandler" }
configuration. Multiple handlers can be separated by a space. A
function can be supplied instead of a string handler name.

## Marionette.unbindEntityEvents

This method can be used to unbind callbacks from entities' (collection/model) events. It's
the opposite of bindEntityEvents, described above. Consequently, the APIs are identical for each method.

```js
// Just like the above example we bind our model events.
// This time, however, we unbind them on close.
Backbone.View.extend({

modelEvents: {
"change:foo": "doSomething"
},

initialize: function(){
Marionette.bindEntityEvents(this, this.model, this.modelEvents);
},

doSomething: function(){
// the "change:foo" event was fired from the model
// respond to it appropriately, here.
},

onClose: function() {
Marionette.unbindEntityEvents(this, this.model, this.modelEvents);
}

});
```

## Marionette.normalizeMethods

Receives a hash of event names and functions and/or function names, and returns the
Expand Down

0 comments on commit 999fa5e

Please sign in to comment.