let i = document.querySelector('input')
i.addEventListener('input',fangdou(requrst,2000))
function fangdou(fn,time){
let timer = null
return args=>{
if(timer) clearTimeout(timer)
timer = setTimeout(fn,time)
}
}
function requrst(){
console.log('发送请求');
}*/
```
let box = document.querySelector('.box')
box.addEventListener('mousemove',jieliu(requrst,2000))
function jieliu(fn,delay){
let timer = 0
return args=>{
const now = Date.now()
if(now - timer >= delay){
fn()
timer = now
}
}
}
function requrst(){
console.log('发送请求');
}