Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for unbindEntityEvents #1364

Merged
merged 1 commit into from
May 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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