Created
May 10, 2013 03:43
-
-
Save robertwalsh0/5552252 to your computer and use it in GitHub Desktop.
module pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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