This commit is contained in:
zoujiandong
2024-03-19 13:12:28 +08:00
parent 43153c15a7
commit ed5f8c5c22
9 changed files with 45 additions and 27 deletions
+14
View File
@@ -0,0 +1,14 @@
const throttle=function(fn,wait=1500){
var flag = true;
var timer = null;
return function(){
if(flag) {
fn.apply(this,arguments);
flag = false;
timer = setTimeout(() => {
flag = true
},wait)
}
}
}
export {throttle}