zoujiandong b496603f7c 111
2025-06-17 17:58:29 +08:00

19 lines
279 B
JavaScript

const throttle=function(fn,wait=1000){
var flag = true;
var timer = null;
return function(){
if(flag) {
fn.apply(this,arguments);
flag = false;
timer = setTimeout(() => {
flag = true
},wait)
}
}
}
module.exports = {
throttle
}