Open lewenweijia opened 4 years ago
## 防抖
function debounce(fn, time) {
let timeId;
return function (...args) {
const context = this;
clearTimeout(timeId);
timeId = setTimeout(() => {
timeId = null;
fn.apply(context, args)
}, time);
}
}