mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Use Date.now in modern builds.
Former-commit-id: de4329c5f4eaa92da8447e1232ce28e00a0f885d
This commit is contained in:
13
lodash.js
13
lodash.js
@@ -497,6 +497,7 @@
|
||||
fnToString = Function.prototype.toString,
|
||||
getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
|
||||
hasOwnProperty = objectProto.hasOwnProperty,
|
||||
now = reNative.test(now = Date.now) && now,
|
||||
push = arrayRef.push,
|
||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||
setImmediate = context.setImmediate,
|
||||
@@ -5372,7 +5373,7 @@
|
||||
clear();
|
||||
if (isCalled) {
|
||||
if (maxWait !== false) {
|
||||
lastCalled = new Date;
|
||||
lastCalled = +new Date;
|
||||
}
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
@@ -5381,7 +5382,7 @@
|
||||
var maxDelayed = function() {
|
||||
clear();
|
||||
if (trailing || (maxWait !== wait)) {
|
||||
lastCalled = new Date;
|
||||
lastCalled = +new Date;
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
};
|
||||
@@ -5400,15 +5401,15 @@
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
} else {
|
||||
var now = new Date;
|
||||
var stamp = +new Date;
|
||||
if (!maxTimeoutId && !leading) {
|
||||
lastCalled = now;
|
||||
lastCalled = stamp;
|
||||
}
|
||||
var remaining = maxWait - (now - lastCalled);
|
||||
var remaining = maxWait - (stamp - lastCalled);
|
||||
if (remaining <= 0) {
|
||||
clearTimeout(maxTimeoutId);
|
||||
maxTimeoutId = null;
|
||||
lastCalled = now;
|
||||
lastCalled = stamp;
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
else if (!maxTimeoutId) {
|
||||
|
||||
Reference in New Issue
Block a user