mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Add back clearTimeout use for debounced.cancel.
This commit is contained in:
@@ -249,7 +249,7 @@
|
|||||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
||||||
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
|
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
|
||||||
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
||||||
'_', 'isFinite', 'parseInt', 'setTimeout'
|
'_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to make template sourceURLs easier to identify. */
|
/** Used to make template sourceURLs easier to identify. */
|
||||||
@@ -1336,7 +1336,8 @@
|
|||||||
splice = arrayProto.splice;
|
splice = arrayProto.splice;
|
||||||
|
|
||||||
/** Built-in method references that are mockable. */
|
/** Built-in method references that are mockable. */
|
||||||
var setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
|
var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
|
||||||
|
setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeCeil = Math.ceil,
|
var nativeCeil = Math.ceil,
|
||||||
@@ -9740,6 +9741,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
|
if (timerId !== undefined) {
|
||||||
|
clearTimeout(timerId);
|
||||||
|
}
|
||||||
lastInvokeTime = 0;
|
lastInvokeTime = 0;
|
||||||
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user