function throttle (fn, delay = 1000) {
let timer = null
return function () {
let context = this
let args = arguments
if (timer) {
return
}
fn.apply(context, args)
setTimeout(() => {
timer = null
}, delay)
}
}
function throttle (fn, delay = 1000) {
let timer = null
return function () {
let context = this
let args = arguments
if (timer) {
return
}
fn.apply(context, args)
setTimeout(() => {
timer = null
}, delay)
}
}