Skip to content

Instantly share code, notes, and snippets.

@interfeis
Created July 2, 2012 16:31
Show Gist options
  • Save interfeis/3034115 to your computer and use it in GitHub Desktop.
Save interfeis/3034115 to your computer and use it in GitHub Desktop.
jQuery module pattern boilerplate
var clientName = window.clientName || {};
(function ($, context) {
// Add the global variables used across the module
var vars = {
variable2 : "test"
};
/*
* Public method that can be used outside of the namespace
* Example: clientName.publicMethod();
*/
context.publicMethod = function () {
};
//private method
function init() {
// Insert all logic to initialize the module
}
// The init will run in the document ready
$(init);
} (jQuery, clientName));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment