首页 > 技术文章 > 防抖函数

zqm0924 2020-10-14 21:44 原文

function debounce(fn,delay){

let timer = null;

return function (){
 clearTimeout(timer);
 timer = setTimeout(function(){
 fn.apply(this);
},delay)
 
}

}

 

推荐阅读