lb.core.application

Core Application

The Core Application manages the life cycle of modules.

Authors

Copyright

Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved

License

BSD License http://creativecommons.org/licenses/BSD/

Version

2011-08-14

Summary
lb.core.applicationCore Application
Functions
setOptions(options)Configure a set of option properties.
getModules(): arrayGet the list of modules added in the application.
addModule(module)Add a new module to the application.
removeModule(module)Remove a module from the application.
startAll()Start all registered modules.
endAll()Terminate all registered modules.
run()Run the application.

Functions

setOptions(options)

Configure a set of option properties.

Each new option is added to the configuration, replacing any existing value of the same name.  Options previously set are otherwise preserved.

Supported Properties

lbBuilderbuilder used in lb.core.Module to create an instance of the Sandbox for the new module from a selection of plugins which define different parts of the Sandbox API.  Defaults to lb.core.plugins.builder, which creates a Sandbox with all the plugins defined in the framework.  Use of a custom builder allows to customize the Sandbox API by loading custom plugins besides or instead of the plugins defined in the framework.
lbFactoryfactory used in the Sandbox methods to create and destroy DOM elements, DOM listeners and DOM events, and used in lb.core.Module to “initialize” the box elements of a new module.  Defaults to lb.base.dom.factory.  Use of a custom factory allows to “initialize” the box by creating widgets associated with DOM elements within which, for example, carry particular CSS class names.

Parameter

optionsobject, a hash of configuration properties.

getModules(): array

Get the list of modules added in the application.

Returns

array, the list of modules (lb.core.Module) added with addModule().

addModule(module)

Add a new module to the application.

Parameter

moduleobject, the new module (lb.core.Module) to add

Note

Nothing happens in case the same instance of module is already present.

removeModule(module)

Remove a module from the application.

Parameter

moduleobject, the module (lb.core.Module) to remove

startAll()

Start all registered modules.

endAll()

Terminate all registered modules.

All registered modules are discarded.

run()

Run the application.

  • startAll gets registered as listener for window ‘load’ event
  • endAll gets registered as listener for window ‘unload’ event
Core Module of Legal Box Scalable JavaScript Application
Sandbox Builder, associate plugins to define the different parts of the API
DOM (Document Object Model) Factory, Adapter Module for Base Library
Close