Backbone View: Inherit and extend events from parent

Posted by brent on Stack Overflow See other posts from Stack Overflow or by brent
Published on 2012-02-22T21:53:22Z Indexed on 2012/04/06 5:29 UTC
Read the original article Hit count: 174

Backbone's documentation states:

The events property may also be defined as a function that returns an events hash, to make it easier to programmatically define your events, as well as inherit them from parent views.

How do you inherit a parent's view events and extend them?

Parent View

var ParentView = Backbone.View.extend({
   events: {
      'click': 'onclick'
   }
});

Child View

var ChildView = ParentView.extend({
   events: function(){
      ????
   }
});

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about backbone.js