mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Expose _.now.
This commit is contained in:
28
lodash.js
28
lodash.js
@@ -512,7 +512,6 @@
|
||||
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,
|
||||
setTimeout = context.setTimeout,
|
||||
@@ -5791,8 +5790,8 @@
|
||||
* @returns {number} Returns the timer id.
|
||||
* @example
|
||||
*
|
||||
* _.defer(function() { console.log('deferred'); });
|
||||
* // returns from the function before 'deferred' is logged
|
||||
* _.defer(function(text) { console.log(text); }, 'deferred');
|
||||
* // logs 'deferred' after one or more milliseconds
|
||||
*/
|
||||
function defer(func) {
|
||||
if (!isFunction(func)) {
|
||||
@@ -5824,9 +5823,8 @@
|
||||
* @returns {number} Returns the timer id.
|
||||
* @example
|
||||
*
|
||||
* var log = _.bind(console.log, console);
|
||||
* _.delay(log, 1000, 'logged later');
|
||||
* // => 'logged later' (Appears after one second.)
|
||||
* _.delay(function(text) { console.log(text); }, 1000, 'later');
|
||||
* // => logs 'later' after one second
|
||||
*/
|
||||
function delay(func, wait) {
|
||||
if (!isFunction(func)) {
|
||||
@@ -6208,6 +6206,23 @@
|
||||
// no operation performed
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds that have elapsed since the Unix epoch
|
||||
* (1 January 1970 00:00:00 UTC).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utilities
|
||||
* @example
|
||||
*
|
||||
* var stamp = _.now();
|
||||
* _.defer(function() { console.log(_.now() - stamp); });
|
||||
* // => logs the number of milliseconds it took for the deferred function to be called
|
||||
*/
|
||||
var now = reNative.test(now = Date.now) && now || function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the given value into an integer of the specified radix.
|
||||
* If `radix` is `undefined` or `0` a `radix` of `10` is used unless the
|
||||
@@ -6830,6 +6845,7 @@
|
||||
lodash.mixin = mixin;
|
||||
lodash.noConflict = noConflict;
|
||||
lodash.noop = noop;
|
||||
lodash.now = now;
|
||||
lodash.parseInt = parseInt;
|
||||
lodash.random = random;
|
||||
lodash.reduce = reduce;
|
||||
|
||||
Reference in New Issue
Block a user