jsx3.lang is known as the package "namespace," which is a plain
JavaScript object and is analogous to the constructor property of a jsx3.Class.
The following is an example of how to define a new package called eg.tests:
jsx3.lang.Package.definePackage(
"eg.tests", // the full name of the package to create
function(tests) { // name the argument of this function "eg"
// define a static method like this:
tests.staticMethod = function() {
...
};
// define a static field like this:
tests.STATIC_FIELD = "...";
}
);
| Method Summary | |
|---|---|
| static void | Defines a new package so that it is available for introspection. |
| static jsx3.lang.Package | Returns the defined package with name equal to strName. |
| Array<jsx3.lang.Class> | Returns an array of all the classes defined in this package. |
| String | getName() Returns the fully-qualified name of this class. |
| Object | Returns the namespace of this package. |
| static Array<jsx3.lang.Package> | Returns a list of all defined packages. |
| Array<String> | Returns the array of static fields defined for this package. |
| jsx3.lang.Method | getStaticMethod(strMethodName : String) Returns the static method defined in this package with name strMethodName. |
| Array<jsx3.lang.Method> | Returns the array of static methods defined for this package. |
| String | toString() |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf |
| Method Detail |
|---|
fctBody are simply added to the pre-existing namespace. Then, all members, whether defined
before the call to this method or with the call to this method, are made introspectable.
This method may be called more than once with the same strName without causing an error. The
package is simply redefined. Only the members that are defined in the namespace object after the last call to
this method will be available for introspection.
It is an error if, after fctBody is executed, any two members of the namespace object equal the
same function object. This is know as method aliasing, which can be a useful technique in JavaScript. Any
method aliasing within the namespace object must occur after the call to this method. Therefore, method aliasing
will cause an error if this package is redefined later.
strName.null if none matches
jsxpackage.strMethodName.strMethodName