For example " change" will be triggered on a model when its state is changed. There are a lot of built in events that backbone framework triggers that we can subscribe to in our application. Its only purpose is to show how the given set of functions work. Note: The above code example is very contrived and far from the real world example. The benefit of using these set of functions over the previously shown one is that the subscribers can keep track of all the events they are subscribed to and then selectively add and remove their subscriptions. Let us create a simple object that extends from Backbone.Event.Ĭatalog.listenToOnce(book, ' changed', catalog.bookChanged) This can be done by calling _.extend method on the object instance. What backbone does is that it lets any object to be associated with backbone events simply by extending from the Backbone.Events.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |