Home

function: after


after(n: number, func: function): function

The opposite of `before`his method creates a function that invokes `func` once it's called `n` or more times.

Example(s):

const saves = ['profile', 'settings']
const done = after(saves.length, () => console.log('done saving!'))

forEach(saves, type => asyncSave({ 'type': type, 'complete': done }))
// => Logs 'done saving!' after the two async saves have completed.

Params:

Name Type Attribute Description
n The number of calls before `func` is invoked.
func The function to restrict.

Returns:

function

  {
    "comment": "/**\r\n * The opposite of `before`his method creates a function that invokes\r\n * `func` once it's called `n` or more times.\r\n *\r\n * @since 0.1.0\r\n * @category Function\r\n * @param {number} n The number of calls before `func` is invoked.\r\n * @param {Function} func The function to restrict.\r\n * @returns {Function} Returns the new restricted function.\r\n * @example\r\n *\r\n * const saves = ['profile', 'settings']\r\n * const done = after(saves.length, () => console.log('done saving!'))\r\n *\r\n * forEach(saves, type => asyncSave({ 'type': type, 'complete': done }))\r\n * // => Logs 'done saving!' after the two async saves have completed.\r\n */",
    "meta": {
        "range": [
            635,
            851
        ],
        "filename": "after.js",
        "lineno": 18,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100000020",
            "name": "after",
            "type": "FunctionDeclaration",
            "paramnames": [
                "n",
                "func"
            ]
        },
        "vars": {
            "": null
        }
    },
    "description": "The opposite of `before`his method creates a function that invokes\r`func` once it's called `n` or more times.",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Function",
            "value": "Function"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "description": "The number of calls before `func` is invoked.",
            "name": "n"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function to restrict.",
            "name": "func"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "Returns the new restricted function."
        }
    ],
    "examples": [
        "const saves = ['profile', 'settings']\rconst done = after(saves.length, () => console.log('done saving!'))\r\rforEach(saves, type => asyncSave({ 'type': type, 'complete': done }))\r// => Logs 'done saving!' after the two async saves have completed."
    ],
    "name": "after",
    "longname": "after",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000004",
    "___s": true,
    "filepath": "after.js"
}