Generic base class (root object).
var obj = new AW.System.Object;
Parent Classes:
None |
clone | Creates an object clone. |
init | Initializes the object. |
setTimeout | Calls the function after the specified delay. |
toString | Converts object to string. |
AW is built using standard javascript prototype-based inheritance but it also uses several conventions to provide additional functionality to AW classes.
// create new constructor function (MyClass)
var MyClass = AW.System.Object.subclass();
// define prototype initialization function
MyClass.create = function(){
// get reference to the class prototype
var obj = this.prototype;
// define new property
obj.value = 0;
// define new method
obj.method = function(){
// ...
}
}
// create new object
var myObj = new MyClass;
// use it!
myObj.method();
AW classes are defined with a call to subclass() method of the parent class. The subclass() method returns a default empty constructor function (= new class) and copies all helper methods into the new constructor. It also assignes a new instance of the parent class to the subclass prototype.
By default the new class prototype initialization is delayed until the first instance of the new class is created. When the new class constructor is called for the first time it will run create() method to initialize members of the prototype object.