function antiShake(func, delay){
var timer = null;
return function(…argus){
clearTimeout(timer);
if(timer == null){
func.apply(this, argus);
timer = “调用一次”;
}else{
timer = setTimeout(() => {
func.apply(this, argus);
}, delay);
}
}
}
封装函数防抖
最新推荐文章于 2022-12-01 14:48:38 发布