AsyncLazy Class
Package: @esfx/async-lazy
A lazy-initialized asynchronous value.
Declaration
export declare class AsyncLazy<T>
Constructors
constructor(factory)
Constructs a new instance of the AsyncLazy
class
Declaration
constructor(factory: () => T | PromiseLike<T>);
Parameters
- factory
- () => T | PromiseLike<T>
Properties
isStarted
Declaration
get isStarted(): boolean;
Property Value
value
Declaration
get value(): Promise<T>;
Property Value
Promise<T>
Methods
for(value)
Declaration
static for<T>(value: T | PromiseLike<T>): AsyncLazy<T>;
Type Parameters
- T
Parameters
- value
- T | PromiseLike<T>
Returns
AsyncLazy<T>
from(factory, args)
Declaration
static from<T, A extends any[]>(factory: (...args: A) => T | PromiseLike<T>, ...args: A): AsyncLazy<T>;
Type Parameters
- T
- A
Parameters
- factory
- (...args: A) => T | PromiseLike<T>
- args
- A
Returns
AsyncLazy<T>