Created
May 30, 2014 06:31
-
-
Save yashprit/c7cf703e1e62de93fd86 to your computer and use it in GitHub Desktop.
This is one of way to Structure jQuery Application
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
(function(ctx, $, undefined){ | |
$(document).ready(function(){ | |
bindEvent(); | |
}) | |
function bindEvent () { | |
//private scope for application | |
} | |
var _private = { | |
handlerOne: function () { | |
}, | |
handlerTwo: function () { | |
} | |
} | |
ctx.intit = function () { | |
//this is my init function in public scope for application bootstap | |
}; | |
ctx.processPrivateData = function () { | |
//this way we will publically | |
}; | |
})(window.APP = window.APP || {}, jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To know about why we have used
undefined
refer to this URL http://stackoverflow.com/questions/9602901/what-is-the-purpose-of-passing-in-undefined, but as of now we can avoid this because mostly all browsers(IE 9+) supports write protection forundefined