public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
(function($) {
//
// Automatically calls all functions in APP.init
//
jQuery(document).ready(function() {
APP.go();
});
 
//
// Module pattern:
// http://yuiblog.com/blog/2007/06/12/module-pattern/
//
var APP = function() {
// For use only inside APP.
var private_var_1 = 'foo';
var private_var_2 = 'bar';
 
// Expose contents of APP.
go: function() {
for (var i in APP.init) {
APP.init[i]();
}
},
init: {
call_automatically_one: function() {
// Called on page-load.
// Can still be called individually, via:
// APP.init.call_automatically_one();
},
call_automatically_two: function() {
// Called on page-load.
// Can still be called individually, via:
// APP.init.call_automatically_two();
}
},
misc: {
call_specifically_one: function() {
// Must be called individually, via:.
// APP.misc.call_specifically_one();
},
call_specifically_two: function() {
// Must be called individually, via:.
// APP.misc.call_specifically_two();
}
}
};
// Pass in jQuery ref.
})(jQuery);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.