Merge pull request #19056 from ramonlsouza/throttle-fix-port

fix: Waiting room indicator sound defective
This commit is contained in:
Anton Georgiev 2023-11-02 06:45:49 -04:00 committed by GitHub
commit a8488ac841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,10 @@ export function throttle(func, delay, options = {}) {
if (leadingExec && leading) { if (leadingExec && leading) {
execute(); execute();
leadingExec = false; leadingExec = false;
const nextExecDelay = elapsed < delay ? delay - elapsed : delay;
setTimeout(function () {
leadingExec = true;
}, nextExecDelay);
} else if (!timeoutId && trailing) { } else if (!timeoutId && trailing) {
timeoutId = setTimeout(function () { timeoutId = setTimeout(function () {
execute(); execute();