Skip to content

Soldier-B/ns.js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

ns.js

A small and simple Javascript namespace function

Syntax

Namespace(namespace[, callbackFn]);

Parameters

  • namespace: Required. String representation of your namespace.
  • callbackFn: Optional. If callbackFn is a function it will be called with this referencing the inner-most object of the specified namespace.

Return Value

The inner-most object of the specified namespace.

Usage

// define namespace
Namespace('utility.component');

// define namespace with callback
Namespace('utility.component', function(){
    this.name = 'component';
});

// assign namespace with callback
var component = Namespace('utility.component', function(){
    this.name = 'component';
});

About

A small and simple Javascript namespace function

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published