Skip to content

Instantly share code, notes, and snippets.

@diegocstn
Created July 1, 2014 22:41
Show Gist options
  • Save diegocstn/305f843211c62bb5c1d5 to your computer and use it in GitHub Desktop.
Save diegocstn/305f843211c62bb5c1d5 to your computer and use it in GitHub Desktop.
JavaScript delegate
app.delegate = function(obj,fn){
return (function(obj,fn,arg){
return function(){ fn.apply(obj, arg);};
})(obj,fn,Array.prototype.slice.call(arguments,2));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment