Skip to content 

Lazy Class

Packages > @fluidframework/common-utils > Lazy

Helper class for lazy initialized values. Ensures the value is only generated once, and remain immutable

Signature:

export declare class Lazy<T> 

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(valueGenerator) Instantiates an instance of Lazy

Properties

List of properties for this class
Property Modifiers Type Description
evaluated boolean Return true if the value as been generated, otherwise false
value T Get the value. If this is the first call the value will be generated

Constructors

Lazy.(constructor)

Instantiates an instance of Lazy

Signature:

constructor(valueGenerator: () => T);

Parameters

List of parameters
Parameter Type Description
valueGenerator () => T the function that will generate the value when value is accessed the first time

Properties

evaluated

Return true if the value as been generated, otherwise false

Signature:

get evaluated(): boolean;

value

Get the value. If this is the first call the value will be generated

Signature:

get value(): T;