func.apply(this, arguments);
在这段代码中做了什么特定的操作?我可以看到,在没有apply
的情况下动态调整元素大小将无法工作,但是,在使用apply
之后,似乎没有进一步完成this
或arguments
。适用于此处的是什么?
function throttle (func, wait) {
var throttling = false;
return function(){
if (!throttling){
func.apply(this, arguments);
throttling = true;
setTimeout(function(){
throttling = false;
}, wait);
}
};
}
它正在做'.apply'总是做什么。仅仅因为'this'和传入的参数在这里没有被使用,并不意味着它们不被用在'func'代码中。 – 2013-03-06 01:36:12
你有函数'func'的代码吗? – bfavaretto 2013-03-06 01:39:40
@bfavaretto它是jsbin链接中的'resize_columns()'。 – 1252748 2013-03-06 01:40:57