我需要在jQuery函数中将参数arguments
用作自己的元素,而不是默认元素。
我的代码:
我应该在$(window).load
中调用backbone超类:
MyController.__super__.scroll.apply(this, arguments);
我做了这样的事情:
我做了类似于这样的东西:
var context = this;
var contextArgs= arguments;
$(window).load(
function(){
MyController.__super__.scroll.apply(context , contextArgs); //call backbone superclass
});
我不想创建新的参数'context' 和 'contextArgs'。我只能通过使用Jquery.proxy来防止创建变量'context = this;'。
var contextArgs= arguments;
$(window).load(
$.proxy(function() {
MyController.__super__.scroll.apply(this , contextArgs);
},this)
);
如何防止创建另一个参数 var contextArgs = arguments;