Created
March 31, 2014 07:01
-
-
Save baniol/9886781 to your computer and use it in GitHub Desktop.
javascript, design patterns, 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
// A Module Pattern | |
PACKAGE_NAME.M = (function () { | |
var privatePropertyOrMethod1 = …; | |
// … | |
var M = {}; | |
M.publicProperty1 = …; | |
M.publicMethod1 = function (…) {…}; | |
// … | |
return M; | |
}()); | |
// Already familiar to JavaScript professionals | |
// (We just prefer avoiding object literals) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment