Allow time change from api (#1009)

Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>
This commit is contained in:
Alex Christoffer Rasmussen
2024-06-02 15:21:09 +02:00
committed by GitHub
parent d8626ff324
commit 3895b37572
6 changed files with 88 additions and 14 deletions
+2 -1
View File
@@ -22,11 +22,12 @@ export function throttle<T extends any[], U>(cb: (...args: T) => U, delay: numbe
return (...args: T) => {
if (shouldWait) {
waitingArgs = args;
return;
return true;
}
cb(...args);
shouldWait = true;
setTimeout(timeoutFunc, delay);
return false;
};
}