Hemi JavaScript Framework
Hemi.app.space
Description
Application Spaces are controlled environments in which the content (XHTML and XML nodes) drives the implementation (via Application Space Definitions). XHTML Nodes (Presentation Nodes) that match space definitions are represented as XHTML Components. XHTML Components can automatically load Application Components, Modules, and Templates (which in turn spawn their own Application Space). These components can be retrieved using unique object identifiers, or more friendly reference identifiers which are contextually sensitive to the space. Form fields are augmented by the Hemi.data.form service to create Virtual Forms. Spaces can load automatically, or use the Hemi.task service to bootstrap asynchronous dependencies.
Class Index
- static Hemi.app.space.service: Static implementation of the Application Space service.
- Hemi.app.space.serviceImpl: The Application Space service is used to create managed environments within Web pages. Each Application Space uses its XHTML contents for self-configuration, instrumentation, and contained lifecycle management.
static Hemi.app.space.service
version 3.1.0
Static implementation of the Application Space service.
Hemi.app.space.serviceImpl
version 3.1.0
The Application Space service is used to create managed environments within Web pages. Each Application Space uses its XHTML contents for self-configuration, instrumentation, and contained lifecycle management.
Index
Object Index
Method Index
- public clearAppSpace: Clears the specified Space, and destroys all components of the Space.
- public clearAppSpaces: Clears all Spaces, and destroys all components in each Space.
- public configureSpace: Applies the specified configuration to the specified engine. This can be used to repurpose Space objects, or to load alternate content into the Space.
- public createSpace: Creates a new Application Space.
- public getPrimarySpace: Returns the primary application space. If a space is not explicitly created prior to the page loading, then, by default, a primary space object is created for the HTML BODY.
- public loadSpaces: Finds all spaces on the current Web page and loads them. A space node is either the body element, or a span, div, or form element with an is-space attribute.
- public newSpaceObject (internal): Creates a new Space object.
Message Index
- public onspaceconfigload: Message published to all subscribers when configuration has been loaded.
Objects
Space
Properties
- space_element as object: The DOM Node associated with this Space.
- space_id as String: The unique identifier of this Space object.
- space_name as String: The friendly name of this Space object.
- space_index as int: The ordinal index of this Space object.
- config_name as String: The configuration name for this Space object. This value specifically applies to a Space Configuration file.
- task as Task: The task object associated with this Space. All Spaces are bootstrapped with a Task object.
- is_primary as boolean: Bit indicating whether this is the primary engine. There can only be one primary engine per hemi.app.space.serviceImpl instance.
- space_implementations as array: Cache of implementation constructors used to build the content within the Space.
Methods
- void addSpaceObject(
o, s)
Adds the specified object to the application space.
- object = getContainer(
)
Returns the node that contains the Space. For example, a DIV node on which the Space was defined.
- PrimitiveWire = getPrimitiveWire(
n)
Returns the specified PrimitiveWire.
- object = getSpaceObject(
i)
Returns the specified object created for this Space.
- object = getSpaceObjectByName(
n)
Returns the specified object created for this Space.
- array = getSpaceObjects(
)
Returns an array of objects created for this Space.
- array = getSpaceObjectsByClass(
n)
Returns an array of objects with the specified class.
- boolean = isSpaceObjectByName(
n)
Returns true if the object exists, false otherwise.
- void Processor(
o, v)
Allows a document to be processed by an outside process before it is copied into the space context.
- void removeSpaceObject(
i)
Removes references to the specified identifier from the space.
Methods
clearAppSpace
Clears the specified Space, and destroys all components of the Space.
Syntax
void clearAppSpace(
i
)
Parameters
- i as variant : Name or object reference of the Space to clear.
clearAppSpaces
Clears all Spaces, and destroys all components in each Space.
Syntax
void clearAppSpaces(
)
configureSpace
Applies the specified configuration to the specified engine. This can be used to repurpose Space objects, or to load alternate content into the Space.
Syntax
void configureSpace(
o, c
)
Parameters
- o as Space : A space object.
- c as String : Name of SpaceService configuration.
createSpace
Creates a new Application Space.
Syntax
v = createSpace(
e, b, pr, xr, fCallBack
)
Parameters
- e as Node : XHTML Element
- b as boolean : Bit indicating the space is being forced.
- pr as function (optional): Processor to assign to the space. Used for pre-processing XML templates and configuration.
- xr as function (optional): XML Handler to use when invoking setInnerXHTML.
- fCallBack as function (optional): Callback handler to be invoked when the space is initialized.
Returns
v as SpaceObject: A new space object that has been tasked to initialize.
getPrimarySpace
Returns the primary application space. If a space is not explicitly created prior to the page loading, then, by default, a primary space object is created for the HTML BODY.
Syntax
oSpace = getPrimarySpace(
)
Returns
oSpace as SpaceObject: The primary space object.
loadSpaces
Finds all spaces on the current Web page and loads them. A space node is either the body element, or a span, div, or form element with an is-space attribute.
Syntax
void loadSpaces(
b, o, pr, xr
)
Parameters
- b as boolean : Bit indicating that a primary space should be defined if one is not specified. This param will always be true if any space exists and none are marked as primary.
- o as object (optional): Object in which to search for potential space declarations.
- pr as function (optional): Processor to assign to the space. Used for pre-processing XML templates and configuration.
- xr as function (optional): XML Handler to use when invoking setInnerXHTML.
newSpaceObject
Creates a new Space object.
Syntax
o = newSpaceObject(
e, i, n, k, x, f
)
Parameters
- e as Node : XHTML Element representing the space.
- i as String : Unique identifier.
- n as String : Friendly name for the object.
- k as TaskObject : Task object used to load this space.
- x as int : Index of space relative to adjacent spaces.
- f as function : Space initialization callback
Returns
o as SpaceObject: New space object.
Messages
onspaceconfigload
Message published to all subscribers when configuration has been loaded.
Syntax
// User-specified script to subscribe to message
org.cote.js.message.MessageService.subscribe("onspaceconfigload",_handle_message);
// Internal: how the message is published to subscribers
org.cote.js.message.MessageService.publish("onspaceconfigload"
, o
);
// User-specified script to handle the message subscription
function _handle_message("onspaceconfigload"
, o
){
// message handler code
}
Parameters
- o as SpaceObject : The EngineObject for which the configuration was loaded.
[ Hemi JavaScript Framework - Stephen W. Cote, 2002 - 2009. ]