Reputation: 7915
Is it possible in javascript / dojo toolkit to call the base constructor with explicitely set constructor arguments (out of the constructor of the inherited class)
dojo.provide("ClassA");
dojo.declare("ClassA", null,
{
constructor: function(text)
{
console.log(text);
}
});
dojo.provide("ClassB");
dojo.declare("ClassB", ClassA,
{
constructor: function()
{
// want to call the base constructor of Class A with "Hello "
console.log("world!");
}
});
I could use this.inherited(arguments, ["Hello "]) but this will produce two calls of the base constructor (one without and one with the given argument). (will produce output of: undefined\n"Hello "\n"world!").
I already tried using the following ways:
dojo.mixin(this, "Hello");
dojo.safeMixin(this, "Hello");
dojo.mixin(ClassA, "Hello");
...
but all things I did seems to call the base constructor twice. Any suggestions?
Upvotes: 3
Views: 2466