debounce(fn, delay=500) { debounce(fn, delay=500) { let timer; return function() { const that = this; const args = arguments; if(timer) { clearTimeout(timer); } timer = setTimeout(() => { timer = null; fn.apply(that, args); }, delay) } }
防抖函数
标签:常用,const,函数,debounce,args,timer,delay,fn From: https://www.cnblogs.com/xyulz/p/17676083.html