JavaScript日常学习
文章目录
防抖函数
`
export cosnt _debounce = (fn, defaultTime) => {
let timer = defaultTime || 200
let timerFn
return function () {
let _that = this
if (timerFn) {
clearTimeout(callBack)
} else {
timerFn = setTimeout(() => {
callBack = null
fn.apply(_that, args)
}, timer)
}
}
}
`
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论