Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:33:14+00:00 2026-05-31T10:33:14+00:00

I’m starting a new Backbone app, and I’ve been quite fond of the javascript

  • 0

I’m starting a new Backbone app, and I’ve been quite fond of the javascript class inheritance system of Sencha Touch 2.0, basically i want to be able to do this :

Helium.define('Application', {
    namespace: 'Helium',
    constructor: function() {
        console.warn('Helium');
    }
});

Helium.define('Application', {
    namespace: 'MyApp',
    extend: 'Backbone.Events',
    routers: ['Cards'],
    constructor: function() {
        console.warn(this);
        this.callParent();
        console.warn('MyApp');
        //console.warn(Helium.getDisplayName(arguments.callee));
    }
});

I’m stuck on the prototype chain definition (to make the this.callParent() work) :

        var p = Object.create(extend);
        var o = _.extend(p, data);
        /*function() {
            var _o = _.extend(p, data);
            _o.constructor.apply(o, arguments);
            return _o;
        };*/
        o.prototype.superclass = p;
        o.prototype.callParent = function() {
            console.warn(p);
        };

Here is the complete micro-implementation so far :

So far, i have done this :

_.mixin({
    resolve : function(path, base, separator) {
        var parts = path.split('.' || separator),
            key = parts.pop();
            base = base || window;

        while (parts.length) {
            part = parts.shift();
            base = base[part] = base[part] || {};
        }
        base[key] = base[key] || {};

        return base[key];
}});

Helium = {

    define: function(className, data) {

        var base = window,
            extend = data.extend || {constructor : function() {}},
            namespace = data.namespace || null;

        if(namespace) {
            window[namespace] = window[namespace] || {};
            base = window[namespace];
        }

        if(_.isString(extend)) extend = _.resolve(extend);
        if(!extend) throw 'Extend error';

        var parts = className.split('.'),
            key = parts.pop();
        while (parts.length) {
            part = parts.shift();
            base = base[part] = base[part] || {};
        }

        delete data.extend;
        //delete data.namespace;
        data.$name = key;
        data.$className = className;

        var p = Object.create(extend);
        var o = _.extend(p, data);
        /*function() {
            var _o = _.extend(p, data);
            _o.constructor.apply(o, arguments);
            return _o;
        };*/
        o.prototype.superclass = p;
        o.prototype.callParent = function() {
            console.warn(p);
        };

    },

    getDisplayName: function(callee) {
        console.warn('getDisplayName', [this, arguments]);
        console.warn(callee.toString());

    }

};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:33:15+00:00Added an answer on May 31, 2026 at 10:33 am

    I see what you’re going for here but if your end game is really being able to call the parent constructor I think it’s a little convoluted to try and impose Sencha’s inheritance model on Backbone because it is so simple and lightweight and ultimately it has its own inheritance implementation.

    Since Backbone’s extend() only exists on Backbone classes I think this is a good resource. Unless I’m misunderstanding you I think something along the lines of MyApp.__super__.initialize() in Backbone would be roughly equivalent to this.callParent() in Sencha Touch.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.