Created
May 13, 2015 19:40
-
-
Save beckettkev/0a5b01f5f8b1920281ca to your computer and use it in GitHub Desktop.
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
var MyCompany = MyCompany || {}; | |
MyCompany.MyProject = MyCompany.MyProject || {}; | |
MyCompany.MyProject.MyAmazingJavaScriptLibrary = MyCompany.MyProject.MyAmazingJavaScriptLibrary || {}; | |
MyCompany.MyProject.MyAmazingJavaScriptLibrary.CoolStuffForKicks = function() { | |
//stuff in here is not exposed globally unless explicitly returned as such | |
var _iAmNotGlobalDude = function() { | |
console.log('Totally private. I am not running for no one external from this script '); | |
}; | |
var _iAmNotGlobalButIDoRunAutomatically = function() { | |
console.log('I am private, but I get run once on script load "automatically"! '); | |
}(); | |
var _iAmPrivateButIGetExposedGloballyByTheReturnStatement = function() { | |
console.log('I am private, but I get Exposed globally by the function return! '); | |
}; | |
return { | |
GlobalExposedPrivates:_iAmPrivateButIGetExposedGloballyByTheReturnStatement | |
}; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment