With anti-shake to prevent duplicate submission page:
function debounce(func, wait) {
let timeout
return function () {
clearTimeout(timeout)
timeout = setTimeout(func, wait) //返回计时器 ID
}
}
use:
debounce(doSomething, 1000);
With anti-shake to prevent duplicate submission page:
function debounce(func, wait) {
let timeout
return function () {
clearTimeout(timeout)
timeout = setTimeout(func, wait) //返回计时器 ID
}
}
use:
debounce(doSomething, 1000);