Skip to content

Instantly share code, notes, and snippets.

@iOS0x00
Created April 1, 2014 07:09
Show Gist options
  • Save iOS0x00/9909237 to your computer and use it in GitHub Desktop.
Save iOS0x00/9909237 to your computer and use it in GitHub Desktop.
Js APP struct demo
var App = function() {
// Basic Config
var config = {
debug: true
};
// HomeView
var home = function() {
console.log('hello home');
};
// End of HomeView
return {
init: function(options) {
//Extends basic config with options
$.extend(config, options);
},
/*Pages Javascript Methods*/
home: function() {
home();
},
};
}();
<script type="text/javascript">
$(document).ready(function() {
//initialize the javascript
App.init();
App.home();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment