Extending Custom Backbone View

backbone.js, javascript

Solution

I think what you're looking for is:

 var NewView = MyView.extend({
     //Usual config goes on in here, and it will have inherited functions
     //And default properties from MyView
 });

Or, if you are looking to call the super class then there is an implementation of it here: http://forrst.com/posts/Backbone_js_super_function-4co

Problem

Using ``` Backbone.View.extend ``` I have created a Backbone View called MyView. In my view I've created a bunch of custom functions. The problem I'm having is that I need to create a new Backbone view that extends MyView. I don't want to create a new View and duplicate code... I just want to utilize inheritance to extend functionality... Problem is that I don't know the way to do it exactly, and I also don't know how to call the super functions in Backbone. *Edit - Thanks for the answers by some below, but still not quite sure how to call parent's method. For example: ``` // in subView { initialize: function(){ // would like to do something like super.initialize() // here i would then declare variables exclusive to subview } ```

Original source