4 网友分享了链接
2020-09-18 05:27:33
function a() {
if (!a.Timeout_) {
console.debug('前去抖测试', new Date());
}
a.Timeout_ = setTimeout(() => {
clearTimeout(a.Timeout_ || -1);
a.Timeout_ = '';
}, 2000)
}
多次调用方法, 仅第一次打印日志 a();a();a();a();a();