Skip to content

Instantly share code, notes, and snippets.

@apathetic
Created October 22, 2012 17:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apathetic/3932743 to your computer and use it in GitHub Desktop.
Save apathetic/3932743 to your computer and use it in GitHub Desktop.
Structuring Javascript
(function( wes, $, undefined ) {
// ------------ private ------------
function privateFn() {
}
// ------------ public ------------
wes.publicFn = function() {
// public function
}
wes.hatch = function() { // a.k.a. "init"
// initialization code here
};
}( window.wes = window.wes || {}, jQuery ));
....
jQuery( wes.hatch );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment