Skip to content

Instantly share code, notes, and snippets.

@pbrewczynski
Created July 12, 2013 17:33
Show Gist options
  • Save pbrewczynski/5986229 to your computer and use it in GitHub Desktop.
Save pbrewczynski/5986229 to your computer and use it in GitHub Desktop.
Why we would like to do something like this, if jQuery (jQ) is anyway Global ?
// Global module
var myModule = (function ( jQ, _ ) {
function privateMethod1(){
jQ(".container").html("test");
}
function privateMethod2(){
console.log( _.min([10, 5, 100, 2, 1000]) );
}
return{
publicMethod: function(){
privateMethod1();
}
};
// Pull in jQuery and Underscore
}( jQuery, _ ));
myModule.publicMethod();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment