Skip to content

Instantly share code, notes, and snippets.

@morningtoast
Created June 17, 2013 14:19
Show Gist options
  • Select an option

  • Save morningtoast/5797227 to your computer and use it in GitHub Desktop.

Select an option

Save morningtoast/5797227 to your computer and use it in GitHub Desktop.
JS Module Pattern
var MyModule = (function($, Modernizr) {
// Module variables. Use for local tracking
var data = {
}
// Module init; This will run during onready if module is defined in the <body> data attribute
var init = function() {
_debug("main.init()");
}
// Local methods
var local = {
}
// Module bindings
var bind = {
}
return {
init: init,
data: data
};
}(jQuery, Modernizr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment