//防抖
const debounce_ = function (fn, wait) {
let timer
return function () {
if (!fn) clearTimeout(timer)
timer = setTimeout(() => {
fn()
clearTimeout(timer)
}, wait)
}
}
//节流
const throttle_ = function(fn,wait){
let timer = 0
return function(){
if(Date.now-timer>wait){
fn()
timer = Date.now()
}
}
}