Skip to content

Instantly share code, notes, and snippets.

@lunaroja
Created March 13, 2013 19:30
Show Gist options
  • Save lunaroja/5155313 to your computer and use it in GitHub Desktop.
Save lunaroja/5155313 to your computer and use it in GitHub Desktop.
Simple object fire based on document body ID (Simplified version from Paul Irish)
var APP = APP || {};
APP.fire = {
init : function () {
},
index : function () {
},
finalize : function() {
}
}
/
$(document).ready(function($){
var namespace = APP.fire, context = document.body.id;
if (typeof namespace.init === 'function') namespace.init();
if(namespace && namespace[ context ] && (typeof namespace[ context ] === 'function')) namespace[ context ]();
if (typeof namespace.finalize === 'function') namespace.finalize();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment