classifyed.js
A tiny yet powerful lib to create extensible JS Classes,
with an elegant way of calling parent methods.
Usage
var MyClass = Classifyed.extend({
constructor: function() { ... },
doFoo: function () { ... }
},
{
type: 'MyClass',
staticFoo: function () {
}
});
var SuperClass = MyClass.extend({
constructor: function(){
this.__super__('constructor', arguments);
},
doFoo: function () {
this.__super__('doFoo', arguments);
}
},
{
type: 'SuperClass',
staticFoo: function () {
this.__super__.constructor.staticFoo();
this.parent().staticFoo();
}
});
var myObj = new SuperClass();
myObj.doFoo();
myObj.__super__('doFoo');
console.log(myObj.constructor.type);
console.log(myObj.constructor.__super__.constructor.type);
console.log(myObj.constructor.parent().type);