Class Index | File Index


Class $namespace

This class represents a namespace, but its constructor is used as a function (without the "new" keyword) to create a namespace. It is used as a constructor for private implementation purposes only.

Defined in: class-debug.js.

Class Summary
Constructor Attributes Constructor Name and Description

Creates a namespace.

Method Summary
Method Attributes Method Name and Description
Overridden to return a string that identifies this namespace.
Class Detail

Creates a namespace. Note that this documentation describes the behavior of $namespace when used as a method (without the "new" keyword). This should only be called as a method rather than as a constructor. Instances of $namespace are created as a private implementation detail of $namespace being called as a method.

A namespace is simply a named "container" for classes, methods, properties or even other namespaces.



MyLibrary.UI.Forms.VERSION = 5;

$class("MyLibrary.UI.Forms.Field", {
  // ... properties, methods, etc.

var field = new MyLibrary.UI.Forms.Field();

{String} name
The name of the namespace. The name may describe a path of multiple nested namespace/class/object names separated by a period (.). All namespaces along the path will be created as necessary. For example, a namespace name of "MyLibrary.UI.Forms" will create a namespace named "MyLibrary" that contains a namespace named "UI" which in turn contains a namespace named "Forms". If any of the namespaces in the specified name path already exist, but were not created by $namespace, a warning will be issued by the debug version of the $class library.
{$namespace} the newly created (or pre-existing) namespace. If an entire path of namespaces was created, only the last namespace in the path is returned.
Method Detail: toString
{String} toString()
Overridden to return a string that identifies this namespace. This may be useful for debugging purposes. This also gives each namespace a unique string representation for use as object keys.
{String} a string in the format "[$namespace _name_]", where _name_ is the name of the namespace, including the full path of parent namespaces.

Documentation generated by JsDoc Toolkit 2.3.2 on Sat Nov 13 2010 01:18:48 GMT-0500 (EST)