Here is my implement of some frontend wheel mentioned in 前端开发中有什么经典的轮子值得自己去实现一遍
Another JavaScript Class factory —compared to Prototype, MooTools or Base2.
var A = Class({
constructor: function(name) {
this._name = name
},
getName: function() {
return this._name
},
toString: function() {
return this.getName()
}
})
var B = Class.extend(A)({
constructor: function($super, name, desc) {
$super(name)
this._desc = desc
},
getDesc: function() {
return this._desc
},
toString: function($super) {
return $super() + ': ' + this.getDesc()
}
})
var C = Class.extend(B)({
getName: function($super) {
return '[' + $super() + ']'
}
})