XUL application Javascript API

onInitialize function

function onInitialize(mw, app);

If found in the user-defined Javascript file, this function is called on MainWindow initialization. The MainWinow and Application instance are passed as arguments.

Objects

MainWindow

Represents the application main window (the graphical user interface).

Methods Description
trace(string) Display a message in the shell and debug console
getOptionIdByName(string name,
string subcommand = null)
Return the option control element id of a global or subcommand option.
The name can be one of the long or short name of the option (without dashes).
The subcommand can be the name or one of the alias
addEventListener(event, handler, weak) A wrapper to window.addEventListener.
Used to listen the execute event
Attributes Description
status string (read only)
Main window state. Can be default or execute

Application

Represents the XUL application

Methods Description
trace(string) Display a message in the shell and debug console
quitApplication() Quit the application
getApplicationURI() Return the nsIURI of the application path (where application.ini resides)
getApplicationPath() Return the unescaped path string of the application path (where application.ini resides)
getBundleURI() Return the nsIURI where the application folder (linux) or application bundle (Mac OS X) is located
getBundlePath() Return the unescaped path string where the application folder (linux) or application bundle (Mac OS X) is located
getBundleName() The application bundle name
ex: MyApp (linux) / MyApp.app (Mac OS X)

Events

execute

The execute event is raised by the MainWindow object after executing the command line program.

Attributes Description
executed true if the program was executed
exitValue Program exit code
mainWindow The MainWindow instance
application The Application instance

The program interface definition framework