mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Fixed memory leak with debounce/throttle arguments and context
This commit is contained in:
@@ -5697,6 +5697,7 @@
|
|||||||
if (isCalled) {
|
if (isCalled) {
|
||||||
lastCalled = now();
|
lastCalled = now();
|
||||||
result = func.apply(thisArg, args);
|
result = func.apply(thisArg, args);
|
||||||
|
args = thisArg = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
timeoutId = setTimeout(delayed, remaining);
|
timeoutId = setTimeout(delayed, remaining);
|
||||||
@@ -5711,6 +5712,7 @@
|
|||||||
if (trailing || (maxWait !== wait)) {
|
if (trailing || (maxWait !== wait)) {
|
||||||
lastCalled = now();
|
lastCalled = now();
|
||||||
result = func.apply(thisArg, args);
|
result = func.apply(thisArg, args);
|
||||||
|
args = thisArg = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5733,6 +5735,7 @@
|
|||||||
}
|
}
|
||||||
lastCalled = stamp;
|
lastCalled = stamp;
|
||||||
result = func.apply(thisArg, args);
|
result = func.apply(thisArg, args);
|
||||||
|
args = thisArg = null;
|
||||||
}
|
}
|
||||||
else if (!maxTimeoutId) {
|
else if (!maxTimeoutId) {
|
||||||
maxTimeoutId = setTimeout(maxDelayed, remaining);
|
maxTimeoutId = setTimeout(maxDelayed, remaining);
|
||||||
@@ -5743,6 +5746,7 @@
|
|||||||
}
|
}
|
||||||
if (leadingCall) {
|
if (leadingCall) {
|
||||||
result = func.apply(thisArg, args);
|
result = func.apply(thisArg, args);
|
||||||
|
args = thisArg = null;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user