See the override example from Base.js.
The constructor returns an instance. Is this required? It works fine if the constructor has no return value.
Code:
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
}
});
Ext.define('My.CatOverride', {
override: 'My.Cat',
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callParent(arguments);
alert("Meeeeoooowwww");
return instance;
}
});
Also, the default constructor returns this, but I don’t see that subclasses (e.g. components) return this, so why does the default constructor return this? Should the default constructor be an empty function?
Code:
// Default constructor, simply returns `this`
constructor: function() {
return this;
},
Ext.ClassManager has multiple inline examples where the constructor returns this.