Skip to content

Instantly share code, notes, and snippets.

@pablobm
Created May 27, 2010 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablobm/415658 to your computer and use it in GitHub Desktop.
Save pablobm/415658 to your computer and use it in GitHub Desktop.
function bondage(object, method_name) {
return function() {
return object[method_name].apply(object, arguments);
}
}
class Person(){
}
Person.prototype.doSomething = function() {
// Do something...
}
jdoe = new Person();
$('#something').click(bondage(jdoe, 'doSomething'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment