js 防抖

 

ipt.oninput = antishake(function(){
console.log(this.value)
},500);

function antishake(fn,delay){
var t = null;
return function(){
if(t !== null){
clearTimeout(t);
}
t = setTimeout(() => {
fn.call(this);
},delay)
}
}

https://blog.csdn.net/qq_44741577/article/details/135951852

 

CSDN:防抖

posted on 2024-08-12 18:15  磊有三颗小石头  阅读(25)  评论(0)    收藏  举报

导航