mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Update docs & builds.
Former-commit-id: 84fbc06fe506451e70fb76cef16cbc072468df99
This commit is contained in:
14
dist/lodash.compat.js
vendored
14
dist/lodash.compat.js
vendored
@@ -4468,13 +4468,14 @@
|
||||
*/
|
||||
function debounce(func, wait, options) {
|
||||
var args,
|
||||
inited,
|
||||
result,
|
||||
thisArg,
|
||||
timeoutId,
|
||||
trailing = true;
|
||||
|
||||
function delayed() {
|
||||
timeoutId = null;
|
||||
inited = timeoutId = null;
|
||||
if (trailing) {
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
@@ -4487,15 +4488,15 @@
|
||||
trailing = 'trailing' in options ? options.trailing : trailing;
|
||||
}
|
||||
return function() {
|
||||
var isLeading = leading && !timeoutId;
|
||||
args = arguments;
|
||||
thisArg = this;
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(delayed, wait);
|
||||
|
||||
if (isLeading) {
|
||||
if (!inited && leading) {
|
||||
inited = true;
|
||||
result = func.apply(thisArg, args);
|
||||
} else {
|
||||
timeoutId = setTimeout(delayed, wait);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -4696,10 +4697,9 @@
|
||||
trailing = true;
|
||||
|
||||
function trailingCall() {
|
||||
lastCalled = new Date;
|
||||
timeoutId = null;
|
||||
|
||||
if (trailing) {
|
||||
lastCalled = new Date;
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user