Skip to main content

Function: lazy()

lazy<T>(cb: () => T): () => T

Lazily creates a constant or load a module and caches it internally

Type Parameters​

Type Parameter
T

Parameters​

ParameterTypeDescription
cb() => TThe callback to lazily run

Returns​

Function

The value returned by the callback, or the cached value if it was already initialised once.

Returns​

T

Defined in​

lazy.ts:6