https://github.com/alessioalex/Cls 3 . , 3 ( mixin , Cls, ).
Node.js , .
:
var Person = Cls({
methods: {
constructor: function(name, age) {
this.name = name;
this.age = age;
},
present: function(otherDude) {
return "Hello " + otherDude + " I'm " + this.name + ", my age is: " + this.age;
}
},
});
var Student = Cls({
uber: Person,
present: function() {
return this.inherited('present', arguments);
}
});
var alex = new Student('Alex', 25);
alex.present();