My toolbox, forged to fit my needs, reading the jsjutsu's gurus papers.
console.log(etho.ucfirst('foobar'));
// Print 'Foobar' in the console.
var ParentCl = etho.x({
name: 'ParentCl',
version: '0.1'
}, function ParentCl(value){
console.log(this.meta.name, ' constructor !');
console.log(this.meta);
return this.init(value);
})({
'init': function init(value){
this.value = value;
console.log(this.meta.name + 'Init !');
},
'baz' : function baz(arg){
console.log(this.meta.name + ':baz this', this);
return this.meta.name + ' ' + arg + ' ' + this.value + ' Baz'
}
});
var ChildCl = etho.x('ChildCl', ParentCl, function ChildCl(value){
console.log(this.meta.name, ' constructor !');
console.log(this.meta);
this.parentMethod('init')(value);
})({
'baz' : function baz(){
return 'Wrapped ' + this.parentMethod('baz')('Bob') + ' Up';
}
});
var childCl = new ChildCl('Value that passe everywhere !!!');
console.log(bar.baz());
/** Output in console:
ChildCl:baz this [Object(instance of ChildCl)]
Wrapped ChildCl bob Up
**/