Options
All
  • Public
  • Public/Protected
  • All
Menu

Module after

Index

References

Functions Function

References

Renames and re-exports after

Function Functions

  • after<T>(n: number, func: T): T
  • The opposite of before. This method creates a function that invokes func once it's called n or more times.

    since

    5.3.0

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

    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.