mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Make shouldInvoke explicitly return true if it's the first call.
This commit is contained in:
13
lodash.js
13
lodash.js
@@ -9294,14 +9294,11 @@
|
|||||||
var timeSinceLastCall = time - lastCallTime,
|
var timeSinceLastCall = time - lastCallTime,
|
||||||
timeSinceLastInvoke = time - lastInvokeTime;
|
timeSinceLastInvoke = time - lastInvokeTime;
|
||||||
|
|
||||||
// Either activity has stopped and we're at the trailing edge, the system
|
// Either this is the first call, activity has stopped and we're at the
|
||||||
// time has gone backwards and we're treating it as the trailing edge, or
|
// trailing edge, the system time has gone backwards and we're treating
|
||||||
// we've hit the `maxWait` limit.
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
||||||
return (
|
return (!lastCallTime || (timeSinceLastCall >= wait) ||
|
||||||
(timeSinceLastCall >= wait) ||
|
(timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait));
|
||||||
(timeSinceLastCall < 0) ||
|
|
||||||
(maxWait !== false && timeSinceLastInvoke >= maxWait)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function timerExpired() {
|
function timerExpired() {
|
||||||
|
|||||||
Reference in New Issue
Block a user