Namespace

namespace~ Namespace

Namespace creation, manipulation and traversal utility. This utility is used to create semi-global shared namespaces for registering references to interfaces, classes and constants of the application to provide access to each other more easily than by using the ES6 import/export mechanism.

Constructor

new Namespace()

Source:
Deprecated:
  • Yes
Initializes the namespace provider. This is a private constructor, you should use the exported ns instance to create and use namespaces (see the examples).

Methods

get(path) → {*}

Source:
Return value for the specified namespace path point.
Parameters:
Name Type Description
path string The namespace path to test.
Returns:
The value at the specified path in the namespace.
Type
*

has(path) → {boolean}

Source:
Verifies that the specified namespace path point to an existing namespace or terminal value.
Parameters:
Name Type Description
path string The namespace path to test.
Returns:
true if the namespace or terminal value exists at the specified path.
Type
boolean

namespace(path) → {*}

Source:
Deprecated:
  • Yes
Verifies that the specified path in namespace exists, creates it if it does not, and returns the value at the specified path in the namespace. The method recursively creates all path parts in the namespaces as empty plain objects for all path parts that do not exist yet, including the last one. This means, that if called with a non-existing namespace path as an argument, the return value will be the last created namespace object.
Parameters:
Name Type Description
path string The namespace path.
Returns:
The value at the specified path in the namespace.
Type
*