@ -24,7 +24,7 @@ const throttle = (fn, wait) => {
|
|||||||
fn.apply(context, args);
|
fn.apply(context, args);
|
||||||
lastTime = Date.now();
|
lastTime = Date.now();
|
||||||
}
|
}
|
||||||
}, wait - (Date.now() - lastTime));
|
}, Math.max(wait - (Date.now() - lastTime), 0));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user