Skip to content

Instantly share code, notes, and snippets.

@guipacheco2
Created March 22, 2014 17:57
Show Gist options
  • Save guipacheco2/9711525 to your computer and use it in GitHub Desktop.
Save guipacheco2/9711525 to your computer and use it in GitHub Desktop.
Javascritp module pattern
(function (window, document, undefined){
'use strict';
var App = (function () {
var exports = {},
module = {};
module._privateVar = 'This is a private variable';
module._privateMethod = function _privateMethod() {
return 'This is a private method';
};
module.otherMethod = function otherMethod() {
return 'This is a other method';
};
exports.otherMethod = module.otherMethod;
exports.publicVar = 'This is a public variable';
exports.publicMethod = function publicMethod() {
return 'This is a public method';
};
return exports;
})();
window.App = App;
})(window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment