Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseDelay = require('../internal/baseDelay'),
2
restParam = require('./restParam');
3
4
/**
5
* Invokes `func` after `wait` milliseconds. Any additional arguments are
6
* provided to `func` when it is invoked.
7
*
8
* @static
9
* @memberOf _
10
* @category Function
11
* @param {Function} func The function to delay.
12
* @param {number} wait The number of milliseconds to delay invocation.
13
* @param {...*} [args] The arguments to invoke the function with.
14
* @returns {number} Returns the timer id.
15
* @example
16
*
17
* _.delay(function(text) {
18
* console.log(text);
19
* }, 1000, 'later');
20
* // => logs 'later' after one second
21
*/
22
var delay = restParam(function(func, wait, args) {
23
return baseDelay(func, wait, args);
24
});
25
26
module.exports = delay;
27
28