Namespacing method?
Aaron Zeckoski
aaronz at vt.edu
Wed Jul 29 11:07:41 UTC 2009
I am trying to figure out the best practice for JS namespacing and
there is a ton of conflicting information out there.
I have sorta settled on one of these:
1) From some of the websites on namespacing
var AZ = function($) {
var private_var;
function private_method() {
// do stuff here
}
return {
initDeleteList : function(deleteUrlPrefix, deleteClass, itemPrefix,
itemDeletePrefix) {
// do stuff here
},
method_2 : function() {
// do stuff here
}
};
}(jQuery);
2) From looking at the Fluid stuff as an example
var AZ = AZ || {};
(function($){
var private_var;
function private_method() {
// do stuff here
}
AZ.initDeleteList = function(deleteUrlPrefix, deleteClass,
itemPrefix, itemDeletePrefix) {
// do stuff here
}
AZ.method_2 = function() {
// do stuff here
}
)}(jQuery);
3) ??????????
Any recommendations on best practices?
Is there a webpage I should be looking at?
-AZ
--
Aaron Zeckoski (azeckoski (at) vt.edu)
Senior Research Engineer - CARET - University of Cambridge
https://twitter.com/azeckoski - http://www.linkedin.com/in/azeckoski
http://aaronz-sakai.blogspot.com/ - http://tinyurl.com/azprofile
More information about the fluid-work
mailing list