Skip to content

Instantly share code, notes, and snippets.

@floriankraft
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save floriankraft/94fdea1aee5c5382ab28 to your computer and use it in GitHub Desktop.
Save floriankraft/94fdea1aee5c5382ab28 to your computer and use it in GitHub Desktop.
Scaffold for the Javascript Module Pattern.
var NamespaceName = NamespaceName || {};
NamespaceName.ModuleName = function () {
var aPublicProperty = "foo";
var aPrivateProperty = "bar";
var init = function () {
// some code here ...
};
var aPrivateFunction = function () {
// some code here ...
};
var aPublicFunction = function () {
// some code here ...
};
return {
aPublicProperty: aPublicProperty,
init: init,
aPublicFunction: aPublicFunction
};
}();
NamespaceName.ModuleName.aPublicProperty;
NamespaceName.ModuleName.init();
NamespaceName.ModuleName.aPublicFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment