lb.core.Module

Core Module of Legal Box Scalable JavaScript Application

Each Module corresponds to an independent unit of functionality.

For the purpose of this life cycle management, a new Module instance is created for each User Interface Module and each Data Model Module added on the Core Application.

Authors

Copyright

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

License

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

Version

2013-09-09

Summary
lb.core.ModuleCore Module of Legal Box Scalable JavaScript Application
Functions
new Module(id,creator): ModuleConstructor of a new Core Module.
getId(): stringGet the module identifier.
getSandbox(): objectGet the sandbox allocated to the module.
start()Create and start the underlying module.
end()Terminate the underlying module.

Functions

new Module(id,creator): Module

Constructor of a new Core Module.

Parameters

idstring, the module identifier, e.g.  ‘lb.ui.myModule’
creatorfunction, a creator function returning a custom module.  A new Sandbox instance will be provided as parameter.

Returns

object, the new instance of Module

Notes

Creator functions for User Interface modules may be registered in the namespace ‘lb.ui’, e.g. lb.ui.myModule while creator functions for Data modules, with no user interface, may be registered in the namespace ‘lb.data’, e.g. lb.data.myModule.

The sandbox API can be customized by configuring a different builder to load additional or alternative plugins.  See lb.core.plugins.builder for details.

getId(): string

Get the module identifier.

Returns

string, the module identifier, as given in contructor.

getSandbox(): object

Get the sandbox allocated to the module.

Returns

object, the module’s sandbox.

start()

Create and start the underlying module.

Notes

  • the start method is optional on the underlying module; it will not be called when omitted.
  • before starting the module, the initElement() method is triggered on the configured factory with the box element of the module as argument, if a custom factory has been configured which supports the method and the box is present in the document.

end()

Terminate the underlying module.

Note

The end() method is optional on the underlying module; it will not be called when omitted.  In any case, removeAllListeners() will be called on the sandbox to cleanup any remaining DOM listeners, and destroyElement() will be called on the configured factory to terminate the box element and any widgets included within.

Sandbox Builder, associate plugins to define the different parts of the API
Close