jClass
A small but powerful javascript Class system implementation
Function
To provide a javascript Class combined with single-inheritance and multiple-mixins.
Core API
Declare:
jClassdeclareSuperClass/**<Function>*/ mixins/**<Array.<plain object>>*/ props/**<plain object>*/
Mixin:
jClass;
Keywords:
this.$super
Call super function inside overridden func$constructor
Prop key which define constructor function (which is called on creating new class instance)
Usage
Declare a Base class
var BaseClass = jClassdeclarenull null $ { console; } propA: 'valueA' { console; } ;
Define mixin (which is just a plain object) and call super func
var mx = { this; console; }
Inherit existed class and mixin
var SubClass = jClassdeclareBaseClass mx $ { this; console; } { this; console; } ;
Instantiation
var subInstance = ;// produce console log ==>// Base constructor// Sub constructorsubInstance;// produce console log ==>// Base func// mx func with arg value as "hello"// Sub func