Following my previous article on object oriented programming in Javascript, I released yesterday a small script which allows you to manage namespaces. I know that solutions already exist. Not considering the one from libraries (I wanted a library independent script), I was not satisfied by any of them.

Namespace.js is very simple to use. It contains all common actions encountered when dealing with namespaces. It can import objects in the global scope or include remote scripts based on their namespace. It is very small (5.4 Kb minified), open source and of course library independent.

I published the project on Github at

Here are some examples:

Namespace(''); = function() {};

Namespace('com.example', {
   MyClass: function() { return {}; }
var obj = new com.example.MyClass();

var obj2 = new MyClass();

// include com/example/RemoteClass.js
var obj3 = new com.example.RemoteClass();


comments powered by Disqus