Download qooxdoo Documentation

Transcript
qooxdoo Documentation, Release 1.3.1
The instance members can be accessed by using an actual instance of a class:
var myClass1 = new my.cool.Class;
myClass1.foo = 3.141;
myClass1.bar();
Accessing Static Members
Generic form. Requires no updates if class name changes. This code can optionally be optimized for performance in
build versions.
qx.Class.define("my.cool.Class",
{
statics : {
PI : 3.141
}
members : {
circumference : function(radius) {
return 2 * this.self(arguments).PI * radius;
}
}
});
Note: For this.self to be available, the class must have as a direct or indirect base class qx.core.Object.
Note: Static members aren’t inherited. For calling a superclass static method, use this.superclass, like in this
example:
qx.Class.define(’A’, {
statics: {
f: function() {}
}
});
qx.Class.define(’B’), {
extend: A,
members: {
e: function() {
this.superclass.self(arguments).f();
}
}
});
Static functions can access other static functions directly through the this keyword.
Calling the Superclass Constructor
Generic form. Requires no updates if super class (name) changes. This code can optionally be optimized for performance in build versions.
qx.Class.define("my.cool.Class",
{
extend : my.great.SuperClass,
construct : function(x) {
this.base(arguments, x);
}
});
50
Chapter 3. Core Framework