If I want to create a jQuery function using Function.prototype.bind, i.e. to the need for a wrapping function, which this value do I supply? The following trivial example does not seem to work:
// e.g.: $.fn.outerHeight() with argument true gets height including margin
$.fn.marginBoxHeight = $.fn.outerHeight.bind($.fn, true);
$.fn was the wrong choice here for the this argument. What should it be, so that the function would have access to jQuery internal methods, if needed?
jQuery.proxyperforms currying as follows:The simplest example would be:
References
jQuery.proxy() | jQuery API Documentation
jquery/core.js at master · jquery/jquery
jQuery Combinators by raganwald
Combinator Recipes for Working With Objects in JavaScript
Ingredients of Effective Functional JavaScript: Closures, Partial Application and Currying
Partial function application for humans | Andrew Berls
Practical Applications of Partial Application