I need use parameter arguments in jQuery function as my own element, not as default element.
My code:
I should call backbone superclass in $(window).load:
MyController.__super__.scroll.apply(this, arguments);
I make something like this:
var context = this;
var contextArgs= arguments;
$(window).load(
function(){
MyController.__super__.scroll.apply(context , contextArgs); //call backbone superclass
});
I don`t want to create new param ‘context ‘ and ‘contextArgs’.
I can only prevent creation var context = this; by using Jquery.proxy:
var contextArgs= arguments;
$(window).load(
$.proxy(function() {
MyController.__super__.scroll.apply(this , contextArgs);
},this)
);
How prevent creation another param var contextArgs= arguments;
You can pass in other arguments to
proxyand they’ll be available as arguments in the function: