Programmer's Guide > Using the AOM > Using JavaScript to Access the AOM > JavaScript Language Extensions
  
JavaScript Language Extensions
The Arbortext Editor JavaScript implementation includes a few non-standard extensions, modeled on similar features provided by the Rhino Shell. The Rhino Shell is a standalone utility from Mozilla that runs JavaScript programs.
Function
Description
defineClass(javaclass)
This global function defines a JavaScript class from the Java class specified by javaclass. The Java class file must be in the class path set for the Java Virtual Machine embedded in Arbortext Editor, for example, by including the .class file in the Arbortext-path\custom\classes directory.
javaclass must implement the org.mozilla.javascript.Scriptable interface or extend the org.mozilla.javascript.ScriptableObject class. See the Rhino documentation at the Mozilla web page (www.mozilla.org/rhino/doc.html) for details.
implementationVersion()
This global function returns the JavaScript interpreter implementation version as a string encoding the product name, language version, release number, and date.
importClass(javaclass)
This global function will “import” the Java class javaclass by making its unqualified name available as a property of the top-level scope.
importPackage(javapackage)
This global function will “import” all the classes of the Java package javapackage by searching for unqualified names as classes qualified by the given package. This is similar to the Java import statement.
* 
If this function is evaluated in the global scope, then the unqualified names are available to all JavaScript code subsequently executed in the shared scope.
load(filename, ...)
This global function will load and execute the JavaScript source file given by the filename argument. Multiple file name arguments may be specified and filename can be a URL.
If filename is not an absolute path or URL, the list of directories is the list in loadpath parameter of the setOption method, described in AOM set Options Overview.
If filename is not found relative to the current directory and is not an absolute path, the list of directories specified in the Arbortext Editor (or the Arbortext Publishing Engine) loadpath parameter is searched to locate the JavaScript source file.
print(expr)
This global function evaluates the expression expr and prints the string value of the result to the Java Console. If the Java Console is not open, the output is discarded. The print function supplies a trailing new line character, so each call to print() ends a line.
quit()
This global function terminates the current script execution. It is provided so sample Rhino JavaScript scripts can be run unmodified within Arbortext Editor and the Arbortext Publishing Engine. This function is implemented by throwing a special JavaScriptException object; if quit() is used inside a try block with a catch, it will not function as expected.