Created
November 14, 2014 11:48
-
-
Save shaunwallace/6ecbaf1e4167a6b538ae to your computer and use it in GitHub Desktop.
Module Pattern Definition
This file contains hidden or 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
var APP = (function() { | |
// private members | |
var foo = true; | |
var bar = false; | |
// private method | |
function baz() { | |
return 1; | |
} | |
// public api | |
return { | |
fooBar : function() { | |
return 0; | |
} | |
} | |
}()); | |
APP.foo; // will output undefined | |
APP.baz(); // will throw an Uncaught TypeError | |
APP.fooBar; // will outout 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment