Invokes `func` after `wait` milliseconds. Any additional arguments are provided to `func` when it's invoked.
delay(text => console.log(text), 1000, 'later')
// => Logs 'later' after one second.
Name | Type | Attribute | Description |
---|---|---|---|
func | The function to delay. | ||
wait | The number of milliseconds to delay invocation. | ||
args | The arguments to invoke `func` with. |
{ "comment": "/**\r\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\r\n * provided to `func` when it's invoked.\r\n *\r\n * @since 0.1.0\r\n * @category Function\r\n * @param {Function} func The function to delay.\r\n * @param {number} wait The number of milliseconds to delay invocation.\r\n * @param {...*} [args] The arguments to invoke `func` with.\r\n * @returns {number} Returns the timer id.\r\n * @example\r\n *\r\n * delay(text => console.log(text), 1000, 'later')\r\n * // => Logs 'later' after one second.\r\n */", "meta": { "range": [ 510, 687 ], "filename": "delay.js", "lineno": 16, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100001751", "name": "delay", "type": "FunctionDeclaration", "paramnames": [ "func", "wait", "args" ] } }, "description": "Invokes `func` after `wait` milliseconds. Any additional arguments are\rprovided to `func` when it's invoked.", "since": "0.1.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Function", "value": "Function" } ], "params": [ { "type": { "names": [ "function" ] }, "description": "The function to delay.", "name": "func" }, { "type": { "names": [ "number" ] }, "description": "The number of milliseconds to delay invocation.", "name": "wait" }, { "type": { "names": [ "*" ] }, "optional": true, "variable": true, "description": "The arguments to invoke `func` with.", "name": "args" } ], "returns": [ { "type": { "names": [ "number" ] }, "description": "Returns the timer id." } ], "examples": [ "delay(text => console.log(text), 1000, 'later')\r// => Logs 'later' after one second." ], "name": "delay", "longname": "delay", "kind": "function", "scope": "global", "___id": "T000002R000201", "___s": true, "filepath": "delay.js" }