Created
March 22, 2014 17:57
-
-
Save guipacheco2/9711525 to your computer and use it in GitHub Desktop.
Javascritp module pattern
This file contains 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 (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