$.proxy
$.proxy(fn, context) ⇒ function
$.proxy(fn, context, [additionalArguments...]) ⇒ function [v1.1.4]
$.proxy(context, property) ⇒ function
$.proxy(context, property, [additionalArguments...]) ⇒ function [v1.1.4]
Get a function that ensures that the value of this
in the original function
refers to the context object. In the second form, the original function is read
from the specific property of the context object.
If additional arguments are passed beyond the 2nd argument, they are applied to every invocation of the wrapped function in front of its actual arguments.
var obj = {name: 'Zepto'},
handler = function(){ console.log("hello from + ", this.name) }
// ensures that the handler will be executed in the context of `obj`:
$(document).on('click', $.proxy(handler, obj))