Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
2.2.2
-
None
-
Unknown
-
Description
See http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
Replace the whole
if (typeof XWiki == "undefined") { XWiki = new Object(); } // XWiki module augmentation XWiki.submodule = Class.create({ //etc });
by
var XWiki = (function(x) { // module augmentation : x.submodule = Class.create({ //etc. }); return x; })(XWiki || {});
which performs better and is conceptually a better construct