Class ResolverBase<T>Abstract

The ResolverBase class handles resolving a factory method and detects recursion. Since JS does not have a synchronization mechanism (lock or otherwise) we have to prevent getValue from double triggering the value factory (optimistic concurrency) or returning return a value that is intermediate between resolving and resolved.

Type Parameters

  • T

Hierarchy

  • default

Constructors

  • Type Parameters

    • T

    Parameters

    • valueFactory: Func<T>
    • _allowReset: boolean = false

    Returns ResolverBase<T>

Properties

_resolveState: {
    created: null | boolean;
    error?: unknown;
    factory?: Func<T>;
    value?: T;
}

Type declaration

  • created: null | boolean
  • Optional error?: unknown
  • Optional factory?: Func<T>
  • Optional value?: T

Accessors

  • get canReset(): boolean
  • Will return true if allowReset is true and a value factory still exists.

    Returns

    Returns boolean

  • get error(): any
  • The error value if previous faulted.

    Returns any

  • get isFaulted(): boolean
  • True if the resolution faulted.

    Returns

    Returns boolean

  • get isValueCreated(): boolean
  • Returns true if the value has been created.

    Returns boolean

Methods

  • Returns void

  • Uses the provided factory to generate the value and returns that value for subsequent requests.

    Returns T

  • Will attempt to reset this resolve if possible and returns true if successfully reset.

    Returns

    Returns boolean

Generated using TypeDoc