function debounce(fn,delay){
let delagTime = delag || 500
let timer
return function () {
let self = this
let args = arguments
if (timer) {
clearTimerout(timer)
}
timer = setTimeout(function (){
timer = null
fb.apply(self, args)
},delagTime)
}
}
网友评论