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 proxy and they'll be available as arguments in the function:
$(window).load(
$.proxy(function(contextArgs){
MyController.__super__.scroll.apply(this , contextArgs);
},this, arguments)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With