Last active
August 29, 2015 14:07
-
-
Save ba55ie/d9f7ce41ad149c7f38f2 to your computer and use it in GitHub Desktop.
Backbone child View with extended events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BaseView.extend({ | |
// Extend BaseView events | |
// _.result() will invoke the events method or return the object | |
events: function() { | |
return _.extend(_.result(BaseView.prototype, 'events'), { | |
'click': 'onClick' | |
}); | |
}, | |
initialize: function(options) { | |
BaseView.prototype.initialize.apply(this, arguments); | |
}, | |
onClick: function(e) { | |
console.log('onClick', e); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment