Skip to content

Instantly share code, notes, and snippets.

@caiovaccaro
Created May 22, 2014 17:47
Show Gist options
  • Save caiovaccaro/6114f1b9980ce0330999 to your computer and use it in GitHub Desktop.
Save caiovaccaro/6114f1b9980ce0330999 to your computer and use it in GitHub Desktop.
JS Starter. Initialize every function of objects inside your NAMESPACE (change that). Does not initialize init functions or functions that begins with _. Uses jQuery .each
NAMESPACE.Start = function() {
$.each(NAMESPACE, function(obj,v) {
if(obj !== 'Start')
$.each(NAMESPACE[obj], function(func, v) {
if(typeof NAMESPACE[obj][func] !== 'undefined' &&
func !== 'init' && func.indexOf('_') !== 0 &&
typeof NAMESPACE[obj][func] === 'function') NAMESPACE[obj][func]();
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment