mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Use now() in the compat and underscore builds too.
This commit is contained in:
9
dist/lodash.compat.js
vendored
9
dist/lodash.compat.js
vendored
@@ -519,6 +519,7 @@
|
||||
fnToString = Function.prototype.toString,
|
||||
getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
|
||||
hasOwnProperty = objectProto.hasOwnProperty,
|
||||
now = reNative.test(now = Date.now) && now || function() { return +new Date; },
|
||||
push = arrayRef.push,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
setImmediate = context.setImmediate,
|
||||
@@ -5475,7 +5476,7 @@
|
||||
trailing = 'trailing' in options ? options.trailing : trailing;
|
||||
}
|
||||
var delayed = function() {
|
||||
var remaining = wait - (new Date - stamp);
|
||||
var remaining = wait - (now() - stamp);
|
||||
if (remaining <= 0) {
|
||||
if (maxTimeoutId) {
|
||||
clearTimeout(maxTimeoutId);
|
||||
@@ -5483,7 +5484,7 @@
|
||||
var isCalled = trailingCall;
|
||||
maxTimeoutId = timeoutId = trailingCall = undefined;
|
||||
if (isCalled) {
|
||||
lastCalled = +new Date;
|
||||
lastCalled = now();
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
} else {
|
||||
@@ -5497,14 +5498,14 @@
|
||||
}
|
||||
maxTimeoutId = timeoutId = trailingCall = undefined;
|
||||
if (trailing || (maxWait !== wait)) {
|
||||
lastCalled = +new Date;
|
||||
lastCalled = now();
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
};
|
||||
|
||||
return function() {
|
||||
args = arguments;
|
||||
stamp = +new Date;
|
||||
stamp = now();
|
||||
thisArg = this;
|
||||
trailingCall = trailing && (timeoutId || !leading);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user