Currently i am implementing some form of class (OO) support in JS, meaning classes with public, private and static members and methods. Also partial class support is available. A class can be created like:
Code: Select all
myClass =
classCreate(
{ ctor : function () {
var self = this;
var privateVar = <value>;
var privateFunc = function () {
//- access to <public, private> via self.
}
this.privilegedFunc = function () {
//- access to <public, private> via this.
}
},
publicVar : <value>,
publicFunc : function () {
//- access to <public> via this.
}
},
{ staticVar : <value>,
staticFunc : function () {
//- access to <static> via <classname>.
}
}
)
Code: Select all
myClass =
classCreate(
{ ctor : function () { }
func1 : function () { }
}
)
myClassExt =
classExtend(
myClass,
{
funcExt : function () { }
}
)
Code: Select all
myClass =
classExtend(
myClass,
{
func2 : function () { }
}
)