Skip to content

Instantly share code, notes, and snippets.

@robertwalsh0
Created May 10, 2013 03:43
Show Gist options
  • Save robertwalsh0/5552252 to your computer and use it in GitHub Desktop.
Save robertwalsh0/5552252 to your computer and use it in GitHub Desktop.
module pattern
var myModule = (function($, undefined){
var myVar1 = '',
myVar2 = '';
var someFunction = function(){
return myVar1 + " " + myVar2;
};
return {
getMyVar1: function() { return myVar1; }, //myVar1 public getter
setMyVar1: function(val) { myVar1 = val; }, //myVar1 public setter
someFunction: someFunction //some function made public
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment