OpenAjax Hub Specification v04 LoadUnload

From MemberWiki

Jump to: navigation, search

(The most current version of the OpenAjax Hub Specification is at http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification.

(This wiki page holds a portion of the version 0.4 internal editorial draft for the OpenAjax Hub 1.0 Specification. The home wiki page for the version 0.4 draft specification is at http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_04. Version 0.4 is preserved for historical reasons and is very much out of date. A key point about version 0.4 is that it was the most recent version of the Hub spec before the March 2007 InteropFest.))


<--previous       contents--^       next-->


Contents

Load/Unload Management

Load/Unload Management Features

The OpenAjax Hub provides the following APIs for managing load and unload event handlers on the <body> element.

  • OpenAjax.addOnLoad()
  • OpenAjax.addOnUnload()

The following APIs are public, but usually are not invoked in typical usage patterns. Their primary value is within automated testing scenarios:

  • OpenAjax.OnLoadHandler()
  • OpenAjax.OnUnloadHandler()

Conformance Requirements

OpenAjax Conformance Requirement (Libraries): Load/Unload Handlers Registered Indirectly Through the Hub

To be OpenAjax Conformant, when the OpenAjax Hub is present within an application, a library MUST register its load and unload event handlers through the Hub instead of registering event listeners directly with the Web browser.

APIs

OpenAjax.addOnLoad(refOrName[, scope, phase])

Registers an event handler non-destructively to be fired when the document's onload handler is executed. FIXME: Bad wording here (and unload)

Parameters

refOrName
A function object reference or the name of a function to be called when the document is loaded.
scope
Optional. An Object in which to execute refOrName when handling the event. If null, window object is used.
phase
Optional. Specifies during what phase of Web page initialization this callback should be invoked. Possible values are library, component, and application (default value). The following describes the Hub's processing model for load event processing:
  1. All <script> tags are evaluated
  2. The Web browser fires the load event, which causes the OpenAjax Hub's load event handler to be invoked. The Hub's handler then performs the following operations in order:
    1. It invokes all registered load event "library" phase callbacks
    2. It invokes all registered load event "component" phase callbacks
    3. It invokes OpenAjax.scanDocument() to perform document markup scanning
    4. It invokes all registered load event "application" phase callbacks

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)


OpenAjax.addOnUnload(refOrName[, scope, phase])

Registers an event handler non-destructively to be fired when the document's onunload handler is executed.

Parameters

refOrName
A function object reference or the name of a function to be called when the document is unloaded.
scope
Optional. An Object in which to execute refOrName when handling the event. If null, window object is used.
phase
Optional. Specifies during what phase of page unload this callback should be invoked. Possible values are library, component, and application (the default). The following describes the Hub's processing model for unload event processing:
  1. All <script> tags are evaluated
  2. The Web browser fires the unload event, which causes the OpenAjax Hub's unload event handler to be invoked. The Hub's handler then performs the following operations in order:
    1. It invokes all registered unload event "application" phase callbacks
    2. It invokes all registered unload event "component" phase callbacks
    3. It invokes all registered unload event "library" phase callbacks

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)


OpenAjax.removeAllOnLoad()

NOTE: This function is public, but it usually is not invoked in typical usage patterns. Its primary value is within automated testing scenarios.

Clears the list of registered load event handlers.

Parameters

None.

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)


OpenAjax.removeAllOnUnload()

NOTE: This function is public, but it usually is not invoked in typical usage patterns. Its primary value is within automated testing scenarios.

Clears the list of registered unload event handlers.

Parameters

None.

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)

OpenAjax.OnLoadHandler()

NOTE: This function is public, but it usually is not invoked in typical usage patterns. Its primary value is within automated testing scenarios.

This is the onload event handler that the OpenAjax Hub implementation registers on the <body> element.

Parameters

None.

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)

OpenAjax.OnUnloadHandler()

NOTE: This function is public, but it usually is not invoked in typical usage patterns. Its primary value is within automated testing scenarios.

This is the onunload event handler that the OpenAjax Hub implementation registers on the <body> element.

Parameters

None.

Return value

None.

Module

This method is part of the "LoadUnload" module. (Note: For a discussion of the Hub's modules, see http://www.openajax.org/member/wiki/OpenAjax_Hub_Specification_v04_Bootstrapping_Modularization_Inclusion.)

Public variables

OpenAjax.loadDone

When the Hub is first loaded, this variable is set to false. When the Hub's document load event processing has been completed (i.e., all registered load event callbacks have been invoked and the markup scanner has been invoked), this variable is set to true.

OpenAjax-conformant libraries must treat this as a read-only variable.

OpenAjax.unloadDone

When the Hub is first loaded, this variable is set to false. When the Hub's document unload event processing has been completed (i.e., all registered unload event callbacks have been invoked), this variable is set to true.

OpenAjax-conformant libraries must treat this as a read-only variable.

Personal tools