Skip to content

Instantly share code, notes, and snippets.

@agentreno
Created January 19, 2017 15:25
Show Gist options
  • Save agentreno/92be78c647dbd10c6f53d833ceb9a36c to your computer and use it in GitHub Desktop.
Save agentreno/92be78c647dbd10c6f53d833ceb9a36c to your computer and use it in GitHub Desktop.
Revealing module pattern with instance variables
var mymodule = (function() {
function init() {
this.first = undefined;
this.second = 'blah';
this.third = [];
}
var getFirst = function(){
console.log(this.first);
};
var getSecond = function(){
console.log(this.second);
};
var getThird = function(){
console.log(this.third);
};
return {
first: null,
second: null,
third: null,
init: init,
getFirst: getFirst,
getSecond: getSecond,
getThird: getThird
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment