can-model
Version:
27 lines (22 loc) • 782 B
Markdown
can-model.prototype.unbind unbind
can-model.prototype
Stop listening to events on this Model.
`model.unbind(eventName[, handler])`
{String} eventName The event to unbind from.
{function} [handler] A handler previously bound with `bind`.
If __handler__ is not passed, `unbind` will remove all handlers
for the given event.
{Model} The Model, for chaining.
`unbind(eventName, handler)` removes a listener
attached with [can-model::bind].
```
var handler = function(ev, createdTask){
}
task.bind("created", handler)
task.unbind("created", handler)
```
You have to pass the same function to `unbind` that you
passed to `bind`.
Unbind will also remove the instance from the store
if there are no other listeners.