Hello,
I am using this to create a few classes and to set up some inheritance structure.
var ControlType = Class.extend({
init: function(){ },
html: function(type){
//Get template based on name of subclass
}
});
var YesNo = ControlType.extend({
init: function(){ },
html: function() {
this._super('YesNo')
}
});
Now I was wonder if it's possible to get the type of the subclass in ControlType.html without passing it explicitly?
Update:
I tried this.constructor without the extend functionality as someone suggested but this returns the type of the parent class. So in the following example the console logs Person() but I need Jimi().
function Person(){
this.say = function(){
console.log(this.constructor);
}
}
function Jimi(){
this.name = 'Jimi';
}
Jimi.prototype = new Person();
var j = new Jimi();
j.say();