Skip to content

Instantly share code, notes, and snippets.

@blacktm
Last active September 4, 2017 04:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacktm/8165811 to your computer and use it in GitHub Desktop.
Save blacktm/8165811 to your computer and use it in GitHub Desktop.
A JavaScript revealing module pattern template.
/*
* module.js - The description of the module.
*/
var Module = (function () {
// Properties
///////////////////////////
var x = 0;
// Private Methods
///////////////////////////
/*
* An example private method.
*/
var privateMethod = function () {};
// Public Methods
///////////////////////////
/*
* An example public method.
*/
var publicMethod = function () {};
// Init
///////////////////////////
x = 10 + x;
// Reveal public methods
return {
publicMethod: publicMethod
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment