Created
April 11, 2012 21:14
-
-
Save D1SoveR/2362661 to your computer and use it in GitHub Desktop.
Shim for missing bind() on iOS browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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