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

Source

lib/lazy.ts:6