mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Ensure _.debounce passes vendor/underscore unit tests.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -5489,7 +5489,9 @@
|
|||||||
thisArg = this;
|
thisArg = this;
|
||||||
trailingCall = trailing && (timeoutId || !leading);
|
trailingCall = trailing && (timeoutId || !leading);
|
||||||
|
|
||||||
if (maxWait !== false) {
|
if (maxWait === false) {
|
||||||
|
var leadingCall = leading && !timeoutId;
|
||||||
|
} else {
|
||||||
if (!maxTimeoutId && !leading) {
|
if (!maxTimeoutId && !leading) {
|
||||||
lastCalled = stamp;
|
lastCalled = stamp;
|
||||||
}
|
}
|
||||||
@@ -5505,12 +5507,12 @@
|
|||||||
maxTimeoutId = setTimeout(maxDelayed, remaining);
|
maxTimeoutId = setTimeout(maxDelayed, remaining);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (leading && !timeoutId) {
|
|
||||||
result = func.apply(thisArg, args);
|
|
||||||
}
|
|
||||||
if (!timeoutId && wait !== maxWait) {
|
if (!timeoutId && wait !== maxWait) {
|
||||||
timeoutId = setTimeout(delayed, wait);
|
timeoutId = setTimeout(delayed, wait);
|
||||||
}
|
}
|
||||||
|
if (leadingCall) {
|
||||||
|
result = func.apply(thisArg, args);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user