Skip to content

Instantly share code, notes, and snippets.

@lukemartin
Created July 8, 2011 06:59
Show Gist options
  • Save lukemartin/1071281 to your computer and use it in GitHub Desktop.
Save lukemartin/1071281 to your computer and use it in GitHub Desktop.
JavaScript: Loose augmentation pattern
// Global UI object
var UI = UI || {};
UI.Generic = (function($) {
var my = {};
// Public
my.foo = "Something";
my.bar = function() {
return "Something else";
};
my.Cat = {};
my.Cat.init = function() {
return;
};
// Private
var hat = 2;
var dingo = function() {
return;
};
return my;
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment