Function lazy

  • Lazy is a wrapper around a value that is computed lazily. It is useful for cases where the value is expensive to compute and the computation may not be needed at all.

    Type Parameters

    • Value

      The type of the value

    Parameters

    • cb: (() => Value)

      The callback to lazily evaluate

        • (): Value
        • Returns Value

    Returns (() => Value)

      • (): Value
      • Returns Value

    Example

    const value = lazy(() => computeExpensiveValue());
    

Generated using TypeDoc