Skip to content

Instantly share code, notes, and snippets.

@seyDoggy
Created December 24, 2014 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seyDoggy/ed22ffaaaece0669df1a to your computer and use it in GitHub Desktop.
Save seyDoggy/ed22ffaaaece0669df1a to your computer and use it in GitHub Desktop.
What is this pattern called?
(function (global, factory) {
factory(global.MyFunc = {});
}(this, function (myfunc) {
// private
var privVar = 'What\'s this pattern called?';
function privFunc (some, text) {
return some + text;
}
// public
myfunc.prop = privVar;
myfunc.method = function (some, text) {
return privFunc(some, text)
};
}));
document.getElementById('question').innerHTML = MyFunc.method("I have a question... ", MyFunc.prop);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment