111117.29
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
export default throttle
|
||||
Reference in New Issue
Block a user