BIS Lightweight Application Development Engine

Javascript Library

BLADE provides a number of functions and objects as part of its common javascript library. This document gives a quick overview of some of those classes, but for more details you should look at the common javascript library jsdoc.


A lot of the core features provided by blade center around the page object, which is holds instances of a number of other classes. The page object is set up by blade at the beginning of a new HTML page. It provides an easy way to control components, handle client-side theme effects, and execute code when the page has finished rendering. Its main variables are:

For example, if you have an pane with an id of "p1" and you want to minimize it, you could use page.components to get a reference to the correct Pane instance by calling page.components["p1"].minimize();. Or, say you want the pane minimized when the page loads. Unfortunately, you you can't call its minimize function if it won't be created until later on in the page. You could do page.onLoad.push(function() { page.components["p1"].minimize(); });.

The Themes object supports post-render theme effects. Typically, a single instance of it (page.themes) is created when the page object is initialized. Themes supports two methods: addHandler(theme, state, handler) and set(id, theme, state). AddHandler associates a handler function with a particular theme and state transition (stored as a 2-dimensional array). Calling set uses theme and state to index the array and pass the handler the id of the object to set.

The Logger makes debugging far easier than successive alert() calls or document.write (which can overwrite the existing HTML document). You can initialize it with page.logger = new Logger(). On initialization, Logger can be passed an object reference to a page element (such as a div) to write its output to. If no object is specified, the logger creates a pop-under window to write to. You can then call the debugger log4j style, with calls like page.logger.log() or page.logger.warn(). You can also set a level to suppress smaller errors.