NewDash

    Function after

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

      Type Parameters

      • T extends (...args: any[]) => any

      Parameters

      • n: number

        The number of calls before func is invoked.

      • func: T

        The function to restrict.

      Returns T

      Returns the new restricted function.

      5.3.0

      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.
    MMNEPVFCICPMFPCPTTAAATR