Backbone events have a variety of methods and a series of the catalog of events. Let’s look at the methods first.
The following are a few methods part of
object.on(event, callback, [context]) binds a callback function to an object. The callback method will be called whenever the event is triggered.
object.off([event], [callback], [context]) removes a previously-bound callback function from an object.
object.trigger(event, [*args]) triggers callbacks for the given event or space-delimited list of events.
object.once(event, callback, [context]) creates a backbone.Model, and it extends the backbone.Model class.
object.listenTo(other, event, callback) tells an object to listen to a particular event on another object.
object.stopListening([other], [event], [callback]) informs any object to stop listening to events.
object.listenToOnce(other, event, callback) causes the
listenTo method to only occur once before the callback function.
||When a model is added to a collection.|
||When a model is removed from a collection.|
||Single event triggered after changes in models in our collection.|
||When the collection’s entire contents have been reset.|
||When the collection has been re-sorted.|
||When a model’s attributes have changed.|
||When a model is destroyed.|
||When a model or collection has started a request to the server.|
||When a model or collection has been successfully synced with the server.|
||When a model or collection’s request to the server has failed.|
||When a model’s validation fails on the client.|
||Fired by the router when any route has been matched.|
||This special event fires for any triggered event. It passes the event name as the first argument and is followed by all trigger arguments.|
View all Courses