JavaScript简单的防抖函数
hliang
最后编辑于 2020年7月20日
直接上代码:
function debounce(fn, time) {
return function(args) {
let that = this
clearTimeout(fn.tid)
fn.tid = setTimeout(() => {
fn.call(that, args)
}, time);
}
}