fn 为逻辑的函数
wait 为出发间隔时间
const debounce = (fn, wait = 1000) => {
if (window.timeout) clearTimeout(window.timeout)
window.timeout = setTimeout(() => {
fn()
}, wait)
}
fn 为逻辑的函数
wait 为出发间隔时间
const debounce = (fn, wait = 1000) => {
if (window.timeout) clearTimeout(window.timeout)
window.timeout = setTimeout(() => {
fn()
}, wait)
}