mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Init lastCallTime as undefined to avoid issues when the sytem time is 0. [closes #2342]
This commit is contained in:
@@ -9606,7 +9606,7 @@
|
|||||||
maxWait,
|
maxWait,
|
||||||
result,
|
result,
|
||||||
timerId,
|
timerId,
|
||||||
lastCallTime = 0,
|
lastCallTime,
|
||||||
lastInvokeTime = 0,
|
lastInvokeTime = 0,
|
||||||
leading = false,
|
leading = false,
|
||||||
maxing = false,
|
maxing = false,
|
||||||
@@ -9657,7 +9657,7 @@
|
|||||||
// Either this is the first call, activity has stopped and we're at the
|
// Either this is the first call, activity has stopped and we're at the
|
||||||
// trailing edge, the system time has gone backwards and we're treating
|
// trailing edge, the system time has gone backwards and we're treating
|
||||||
// it as the trailing edge, or we've hit the `maxWait` limit.
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
||||||
return (!lastCallTime || (timeSinceLastCall >= wait) ||
|
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
||||||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9687,8 +9687,8 @@
|
|||||||
if (timerId !== undefined) {
|
if (timerId !== undefined) {
|
||||||
clearTimeout(timerId);
|
clearTimeout(timerId);
|
||||||
}
|
}
|
||||||
lastCallTime = lastInvokeTime = 0;
|
lastInvokeTime = 0;
|
||||||
lastArgs = lastThis = timerId = undefined;
|
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function flush() {
|
function flush() {
|
||||||
|
|||||||
Reference in New Issue
Block a user