防抖函数 GUIRH 2022-10-11 33 阅读1分钟 debounce(fun, wait){ let timer = null return function(){ let context = this, args = arguments if(timer) clearTimeout(timer) timer = setTimeout(function(){ fun.apply(context, args) }, wait) } }