Rename _.debounce helper executeBoundFunction to complete.

This commit is contained in:
jdalton
2015-06-26 08:21:27 -07:00
parent a8c8bd8113
commit ec7dce7d5b

View File

@@ -7820,12 +7820,12 @@
maxTimeoutId = timeoutId = trailingCall = undefined; maxTimeoutId = timeoutId = trailingCall = undefined;
} }
function executeBoundFunction(shouldExecute, clearTimeoutId) { function complete(isCalled, id) {
if (clearTimeoutId) { if (id) {
clearTimeout(clearTimeoutId); clearTimeout(id);
} }
maxTimeoutId = timeoutId = trailingCall = undefined; maxTimeoutId = timeoutId = trailingCall = undefined;
if (shouldExecute) { if (isCalled) {
lastCalled = now(); lastCalled = now();
result = func.apply(thisArg, args); result = func.apply(thisArg, args);
if (!timeoutId && !maxTimeoutId) { if (!timeoutId && !maxTimeoutId) {
@@ -7837,14 +7837,14 @@
function delayed() { function delayed() {
var remaining = wait - (now() - stamp); var remaining = wait - (now() - stamp);
if (remaining <= 0 || remaining > wait) { if (remaining <= 0 || remaining > wait) {
executeBoundFunction(trailingCall, maxTimeoutId); complete(trailingCall, maxTimeoutId);
} else { } else {
timeoutId = setTimeout(delayed, remaining); timeoutId = setTimeout(delayed, remaining);
} }
} }
function maxDelayed() { function maxDelayed() {
executeBoundFunction(trailing || (maxWait !== wait), timeoutId); complete(trailing || (maxWait !== wait), timeoutId);
} }
function debounced() { function debounced() {