bind
can.Model.prototype.bindListen to events on this Model.
model.bind(eventName, handler)
Parameters
-
eventName
{String}
The event to bind to.
-
handler
{function()}
The function to call when the event occurs. handler is passed the event and the Model instance.
Returns
{can.Model}
The Model, for chaining.
bind(eventName, handler(ev, args...) )
is used to listen to events on this model instance. Example:Use
bind
the same as can.Map.prototype.bind which should be used as a reference for listening to property changes.Bind on model can be used to listen to when an instance is:
like:
bind
also extends the inherited behavior of can.Map.prototype.bind to track the number of event bindings on this object which is used to store the model instance. When there are no bindings, the model instance is removed from the store, freeing memory.