Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

CloudKidStudio/namespace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

namespace

Build Status Dependency Status

JavaScript utility for creating namespaces and organizing JavaScript classes into different packages.

##Installation

namespace can be install using Bower.

bower install cloudkid-namespace

##Usage

Use namespace global function to define your classes within closures.

(function(){	

	// Create a javascript class definition
	var MyUtils = function(){};

	// Assign to a global namespace
	namespace('cloudkid.utils').MyUtils = MyUtils;

}());

Use include to import a reference to the class. Will throw an error if the class doesn't exist.

(function(){
	
	// Include the 
	var MyUtils = include('cloudkid.utils.MyUtils');

}());

Use extend to inherit another class.

(function(){
	
	// Include the 
	var MyClass = function(){};

	// Second argument can either be the full path to the
	// class as a string, or the class reference. It's recommended
	// to use a string or call include() beforehand
	var p = extend(MyClass, "cloudkid.EventDispatcher");

}());

##License

Copyright (c) 2015 CloudKid

Released under the MIT License.

About

JavaScript utility for creating namespaces

Resources

License

Stars

Watchers

Forks

Packages

No packages published