Reputation: 689
I am an newbie to Backbone.js, can anyone explain what exactly these statements mean, particularly these arguments?
this.model.bind("reset", this.render, this);
this.model.bind("change", this.render, this);
this.model.bind("destroy", this.close, this);
Upvotes: 1
Views: 44
Reputation: 43156
As you can see in the documentation, the signature is:
object.on(event, callback, [context])
Object is any backbone object that emits events, in your case a model.
The first argument is the name of the event which we are listening for.
Second argument is a function to invoke when this event occurs, in your case render of a view.
Third argument is the context i.e the object to which this
keyword points to when the callback is executed.
Upvotes: 1