Make shouldInvoke explicitly return true if it's the first call.

This commit is contained in:
John-David Dalton
2016-03-29 08:38:46 -07:00
parent 455eace9c5
commit 277c9bdc7c

View File

@@ -9294,14 +9294,11 @@
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either activity has stopped and we're at the trailing edge, the system
// time has gone backwards and we're treating it as the trailing edge, or
// we've hit the `maxWait` limit.
return (
(timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) ||
(maxWait !== false && timeSinceLastInvoke >= maxWait)
);
// 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
// it as the trailing edge, or we've hit the `maxWait` limit.
return (!lastCallTime || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {