Skip to content

Instantly share code, notes, and snippets.

@franzese
Last active June 29, 2016 01:37
Show Gist options
  • Save franzese/019d50abe00124c52860775487268dbf to your computer and use it in GitHub Desktop.
Save franzese/019d50abe00124c52860775487268dbf to your computer and use it in GitHub Desktop.
Globally accessible IIFE structure
// ensure namescope is available.. define it globally
var Via = Via || {};
// pass global var
(function(Via) {
Via.startMsg = 'Ready!';
Via._isDev = true;
Via.init = function() {
Via.log(Via.startMsg);
};
Via.log = function(msg) {
if(Via._isDev)
console.log(msg)
};
// jq document ready
$(Via.init());
})(Via);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment