From 6434747ef6a7e475784454727afaf51ae3d4cdaf Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 9 Jan 2017 18:44:50 -0800 Subject: [PATCH] Use `Date.now`. --- debounce.js | 7 +++---- now.js | 20 -------------------- 2 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 now.js diff --git a/debounce.js b/debounce.js index 9949f17d3..de04442de 100644 --- a/debounce.js +++ b/debounce.js @@ -1,5 +1,4 @@ import isObject from './isObject.js'; -import now from './now.js'; import toNumber from './toNumber.js'; /** Error message constants. */ @@ -125,7 +124,7 @@ function debounce(func, wait, options) { } function timerExpired() { - const time = now(); + const time = Date.now(); if (shouldInvoke(time)) { return trailingEdge(time); } @@ -154,11 +153,11 @@ function debounce(func, wait, options) { } function flush() { - return timerId === undefined ? result : trailingEdge(now()); + return timerId === undefined ? result : trailingEdge(Date.now()); } function debounced(...args) { - const time = now(); + const time = Date.now(); const isInvoking = shouldInvoke(time); lastArgs = args; diff --git a/now.js b/now.js deleted file mode 100644 index 7d337bb6c..000000000 --- a/now.js +++ /dev/null @@ -1,20 +0,0 @@ -import root from './_root.js'; - -/** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * defer(function(stamp) { - * console.log(now() - stamp); - * }, now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ -const now = () => root.Date.now(); - -export default now;