MyClass = function(params) {
if(params.init){
params.init.call(this, this.Myobject);
}
};
Myclass.prototype.Myobject = { someKeys: 'someStuff'}
I wrote a JavaScript-class with a prototype.object. When I call the class I have the possibility to edit this object:
var myClass = new MyClass({ init: function (Myobject){Myobject.foo = 'bla'}});
and I run this with:
params.init.call(this, this.Myobject);
So this overrides the prototype. Init should rewrite the Myobject for the instance myClass, other instances should use the Prototype if they get no init function.