Created
December 24, 2014 18:50
-
-
Save seyDoggy/ed22ffaaaece0669df1a to your computer and use it in GitHub Desktop.
What is this pattern called?
This file contains hidden or 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
(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