Child pages
  • fluid.registerNamespace

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Wiki Markup
{div:class=api-page}

h1. fluid.registerNamespace(naimspace, env)
{section}
{column:width=70%}

Ensures that an entry in the global namespace exists

{code:javascript|borderStyle=none|bgColor=white}
fluid.registerNamespace(naimspace, env);
{code}

*File name:* {{Fluid.js}}

h2. Parameters

{span:class=borderless-table}
|*{{naimspace}}*| (String) The namespace to be registered. |
|*{{env}}*| (Object) (optional) An environment in which to register the namespace. If not provided, the global {{fluid.environment}} will be used. |
{span}

h2. Return Value
{span:class=borderless-table}
|*Object*| The namespace object, either created or existing. |
{span}

{column}

{column:width=5%}
{column}

{column}
h3. See Also
* [fluid.setGlobalValue]
{column}
{section}
----

h3. Notes

This function can be used to ensure that a namespace exists before adding functions to it. If the namespace already exists, it will be returned.

h3. Example
{code:javascript}
fluid.registerNamespace("fluid.expander");      
fluid.expander.makeDefaultFetchOptions = function (successdisposer, failid, options) {
    ...
};
{code}
This example registers the {{fluid.expander}} namespace before adding the {{makeDefaultFetchOptions()}} function to it.

h3. Example
{code:javascript}
var space = fluid.registerNamespace("fluid.engage.mccord");
space.testFunc = function() {
    ...
};
fluid.engage.mccord.testFunc();
{code}
This example uses the returned namespace to define the function {{testFunc()}}. This function can then be invoked as {{fluid.engage.mccord.testFunc()}}.

{div}