Hemi JavaScript Framework
Hemi.app.module
Description
Modules are external script instrumented with a basic API to operate within the Hemi framework and be included in the Hemi.registry service. Similar to Application Components, the concept permits a typical external JavaScript format but which operates within its own namespace. The module class also includes basic support for unit testing, so that modules may be quickly written to act as externally loaded unit tests. For example, the Application Component Tests includes several unit tests for vetting the Application Component class.
Class Index
static Hemi.app.module.service
version 3.1.9
Static implementation of the hemi.app.module.serviceImpl class.
Hemi.app.module.serviceImpl
version 3.1.9
The module service provides a convenience for modularizing and managing standard JavaScript as reusable components and tests.
Index
Object Index
- public Module: A Module encapsulates the imported JavaScript and an API for operating within the framework.
- public ModuleBase: The ModuleBase is the raw definition from which a Module implementation is created.
Method Index
Objects
Module
A Module encapsulates the imported JavaScript and an API for operating within the framework.
Properties
- Component as XHTMLComponent: A pointer to an underlying XHTMLComponent, if the module is bound to an HTML element via an XHTMLComponent.
- name as String: The name of the module.
- Module as Module: An anonymous pointer to the Module instance, for refering to the instance from the anonymous scope enclosure.
- Container as Node: A pointer to the XHTML Node for which the module was loaded.
- Component as XHTMLComponent: A pointer to the XHTMLComponent created for any Container, if a Container was used.
Methods
ModuleBase
The ModuleBase is the raw definition from which a Module implementation is created.
Properties
- Impls as String[]: An array of object ids representing instances of this ModuleBase.
Methods
DecorateModuleContent
Decorates a module content. Method is virtual and can be overridden.
Syntax
sDecoration = DecorateModuleContent(
sName, sPath, sRaw
)
Parameters
- sName as String : Name of the Module
- sPath as String : Path to the Module
- sRaw as String : The raw imported text of the module.
Returns
sDecoration as String: A value to be included in the module prior to the module being instantiated.
DecorateModuleHeader
Decorates a module header. Method is virtual and can be overridden.
Syntax
sDecoration = DecorateModuleHeader(
sName, sPath, sRaw
)
Parameters
- sName as String : Name of the Module
- sPath as String : Path to the Module
- sRaw as String : The raw imported text of the module.
Returns
sDecoration as String: A value to be included in the module header prior to the module being instantiated.
LoadModule
Loads a Module definition.
Syntax
oModule = LoadModule(
sName, sPath, sDecoration, bPathIsContent, sType
)
Parameters
- sName as String : Name of the Module
- sPath as String (optional): Path to the modules directory.
- sDecoration as String (optional): Additional script to include in the module prior to the module being instantiated.
- bPathIsContent as boolean (optional): Bit indicating that the path is the text of the module to load.
- sType as String (optional): Alternate module type for reference implementations.
Returns
oModule as Module: A new Module object.
NewModule
Creates a new Module object.
Syntax
oModule = NewModule(
sName, oContainer, sPath, oModuleService, bPathIsContent, sType
)
Parameters
- sName as String : Name of the Module
- oContainer as XHTMLComponent (optional): XHTML Component acting as a container for the module.
- sPath as String (optional): Path where the module resides.
- oModuleService as FrameworkObject (optional): A framework object for which a
- bPathIsContent as boolean (optional): Bit indicating that the path is the text of the module to load.
- sType as String (optional): Alternate module type for reference implementations.
Returns
oModule as Module: A new Module object.
Register
Registers a Module object.
Syntax
object = Register(
sName, vContent
)
Parameters
- sName as String : Name of the Module
- vContent as Hash : Object hash representing the module API.
Returns
object as object: Internal module object.
UnloadModule
Unloads the specified module.
Syntax
bRemoved = UnloadModule(
sModule
)
Parameters
- sModule as String : Name of the Test Module
Returns
bRemoved as boolean: Bit indicating whether the module was removed.
UnloadModuleImplementations
Destroys all module implementations for the specified module.
Syntax
bRemoved = UnloadModuleImplementations(
sModule
)
Parameters
- sModule as String : Name of the Module
Returns
bRemoved as boolean: Bit indicating whether the module implementations were removed.
[ Hemi JavaScript Framework - Stephen W. Cote, 2002 - 2011. ]