Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to `func` when it's invoked.
defer(text => console.log(text), 'deferred')
// => Logs 'deferred' after one millisecond.
| Name | Type | Attribute | Description |
|---|---|---|---|
| func | The function to defer. | ||
| args | The arguments to invoke `func` with. |
{
"comment": "/**\r\n * Defers invoking the `func` until the current call stack has cleared. Any\r\n * additional arguments are 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 defer.\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 * defer(text => console.log(text), 'deferred')\r\n * // => Logs 'deferred' after one millisecond.\r\n */",
"meta": {
"range": [
469,
631
],
"filename": "defer.js",
"lineno": 15,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100001725",
"name": "defer",
"type": "FunctionDeclaration",
"paramnames": [
"func",
"args"
]
}
},
"description": "Defers invoking the `func` until the current call stack has cleared. Any\radditional arguments are provided 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 defer.",
"name": "func"
},
{
"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": [
"defer(text => console.log(text), 'deferred')\r// => Logs 'deferred' after one millisecond."
],
"name": "defer",
"longname": "defer",
"kind": "function",
"scope": "global",
"___id": "T000002R000199",
"___s": true,
"filepath": "defer.js"
}