Skip to content

Instantly share code, notes, and snippets.

@twalker
Created October 31, 2010 19:32
Show Gist options
  • Save twalker/657034 to your computer and use it in GitHub Desktop.
Save twalker/657034 to your computer and use it in GitHub Desktop.
sub-module that loads itself dynamically to its parent
// sub-module that loads itself dynamically to its parent
// see: http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
var UTIL = (function (parent, $) {
var self = parent.ajax = parent.ajax || {};
self.get = function (url, params, callback) {
return $.getJSON(url, params, callback);
};
// etc...
return parent;
}(UTIL || {}, jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment