New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added native Function.prototype.bind rendition #11
Conversation
It seems native is slower than using apply but here for coverage anyway! |
Need to call "apply" method of native bind function, else passing a single additional argument (array). https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind I appreciate your help. Thanks! |
So something like this... which prob does nothing more than run the rendition1.js type implementation. oh well! |
I was thinking of: return fn.bind.apply(context, prependArgs); |
But bind doesn't execute does it? |
On Thu, Feb 16, 2012 at 3:16 PM, Paul Connolly <
Not sure what you mean. The wrappers just return the bound function. |
if(Function.prototype.bind){ |
Sorry, I am swamped today. Certainly the example I gave you was wrong. On Thu, Feb 16, 2012 at 4:55 PM, Paul Connolly <
|
I believe you had it before. The rub is in passing along the extra Sorry for any confusion. On Thu, Feb 16, 2012 at 5:20 PM, David Mark dmark.cinsoft@gmail.com wrote:
|
If you think about it, you can shorten the previous version by using On Thu, Feb 16, 2012 at 5:24 PM, David Mark dmark.cinsoft@gmail.com wrote:
|
Off the top of my head, this would be the shortest rendition:- var myBind = function(fn, thisObject) { I'd expect it to be the fastest as well. On Thu, Feb 16, 2012 at 5:28 PM, David Mark dmark.cinsoft@gmail.com wrote:
|
That seems to have worked. |
Should be faster than the - call - based wrapper as well. Add the feature Now we need a forked rendition, which will work in everything (save for IE Thanks! On Thu, Feb 16, 2012 at 5:54 PM, Paul Connolly <
|
Ok forked rendition added as well as the update one. |
Added native Function.prototype.bind rendition
No description provided.