Skip to content

Instantly share code, notes, and snippets.

@craveytrain
Created June 21, 2011 16:55
Show Gist options
  • Save craveytrain/1038308 to your computer and use it in GitHub Desktop.
Save craveytrain/1038308 to your computer and use it in GitHub Desktop.
namespacing callbacks
function exeCallback(callback, params) {
var context = window,
namespaces = callback.split('.'),
func = namespaces.pop();
for (var i = 0, l = namespaces.length; i < l; i++) {
context = context[namespaces[i]];
}
context[func].apply(context, params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment