When I started the creating new namespace JS library I got very useful artile to read.
http://pietschsoft.com/post/2007/07/Creating-Namespaces-in-JavaScript-is-actually-rather-simple.aspx
In this article they covered lot of things ( namespace protection objective )
Here I am using the namespace manager code:
// Create the Namespace Manager that we'll use to
/// make creating namespaces a little easier.
if (typeof Namespace == 'undefined') var Namespace = {};
if (!Namespace.Manager) Namespace.Manager = {};
Namespace.Manager = {
Register:function(namespace){
namespace = namespace.split('.');
if(!window[namespace[0]]) window[namespace[0]] = {};
var strFullNamespace = namespace[0];
for(var i = 1; i < namespace.length; i++)
{
strFullNamespace += "." + namespace[i];
eval("if(!window." + strFullNamespace + ")window." + strFullNamespace + "={};");
}
}
};
// Register our Namespace
Namespace.Manager.Register("Dummy.Utility.Class");
Here I regestered the namspace.
Dummy.Utility.Class.dunnyClass = function() {
this.test= function(){alert("test");}
this.test2= function(){alert("test2");}
}
Using this namaspace JS class in HTML.
var dumdum = new Dummy.Utility.Class.dunnyClass(); dumdum.test(); dumdum.test2();



Pingback: uberVU - social comments
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
Awesome post. I so good to see someone taking the time to share this information
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
Great read. Thanks for the info!