Skip to content

Instantly share code, notes, and snippets.

@D1SoveR
Created April 11, 2012 21:14
Show Gist options
  • Save D1SoveR/2362661 to your computer and use it in GitHub Desktop.
Save D1SoveR/2362661 to your computer and use it in GitHub Desktop.
Shim for missing bind() on iOS browsers
if (!Function.prototype.bind) {
Function.prototype.bind = function(context) {
var original_function = this;
var curry_arguments = Array.prototype.slice.call(arguments, 1);
return function() {
var total_arguments = curry_arguments.concat(Array.prototype.slice.call(arguments, 0));
return original_function.apply(context, total_arguments);
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment