improve throttle function
This commit is contained in:
parent
0688cba0b4
commit
1b65c36743
@ -22,7 +22,7 @@ export function throttle(func, delay, options = {}) {
|
||||
if (leadingExec && leading) {
|
||||
execute();
|
||||
leadingExec = false;
|
||||
const nextExecDelay = elapsed < delay ? delay - elapsed : 0;
|
||||
const nextExecDelay = elapsed < delay ? delay - elapsed : delay;
|
||||
setTimeout(function () {
|
||||
leadingExec = true;
|
||||
}, nextExecDelay);
|
||||
|
Loading…
Reference in New Issue
Block a user