Skip to content

Namespace

Overview

Class Namespace

For debugging or usage in the console, Namespace associates modules with a namespaced global for use in the browser. This does not work in Node.js.

@author Jonathan Olson @author Chris Malley (PixelZoom, Inc.)

import { Namespace } from 'scenerystack/phet-core';

Constructor

new Namespace( name : string )

Instance Methods

register( key : string, value : T ) : T

Registers a key-value pair with the namespace.

If there are no dots ('.') in the key, it will be assigned to the namespace. For example: - x.register( 'A', A ); will set x.A = A.

If the key contains one or more dots ('.'), it's treated somewhat like a path expression. For instance, if the following is called: - x.register( 'A.B.C', C ); then the register function will navigate to the object x.A.B and add x.A.B.C = C.

Instance Properties

name : string

(readonly)

Source Code

See the source for Namespace.ts in the phet-core repository.