Fixed memory leak with debounce/throttle arguments and context

This commit is contained in:
Jay Phelps
2013-11-05 18:50:39 -08:00
parent 3d3c59cea6
commit 84d0664112

View File

@@ -5697,6 +5697,7 @@
if (isCalled) {
lastCalled = now();
result = func.apply(thisArg, args);
args = thisArg = null;
}
} else {
timeoutId = setTimeout(delayed, remaining);
@@ -5711,6 +5712,7 @@
if (trailing || (maxWait !== wait)) {
lastCalled = now();
result = func.apply(thisArg, args);
args = thisArg = null;
}
};
@@ -5733,6 +5735,7 @@
}
lastCalled = stamp;
result = func.apply(thisArg, args);
args = thisArg = null;
}
else if (!maxTimeoutId) {
maxTimeoutId = setTimeout(maxDelayed, remaining);
@@ -5743,6 +5746,7 @@
}
if (leadingCall) {
result = func.apply(thisArg, args);
args = thisArg = null;
}
return result;
};