A class for handling dynamic values and tracking an error / loading state. Unlike a LoadingState this structure handles values that change, and can re-enter the loading state.

Type Parameters

  • T

Implements

Constructors

  • Type Parameters

    • T

    Parameters

    • value$: Observable<undefined | T>
    • loading$: Observable<boolean>
    • error$: Observable<
          | undefined
          | string
          | boolean
          | Error>
    • OptionalonLoad: (() => void)
        • (): void
        • Returns void

    • OptionalonDeleted: (() => void)
        • (): void
        • Returns void

    Returns Future<T>

Properties

canLoad$: Observable<boolean>

Indicates if the future is in a state where the underlying request can be executed

data$: Observable<undefined | T>

The value of Future if the future is in the Data state, otherwise undefined

empty$: Observable<boolean>

True if the Future is in the Empty state, otherwise false

error$: Observable<undefined | Error>

The error given if the Future is in the Error state, otherwise undefined

failed$: Observable<boolean>

True if the Future is in the Error state, otherwise false

loading$: Observable<boolean>

True if the Future is in the Loading state, otherwise false

rawValue$: Observable<undefined | T>

The value of the Future if one is currently given, otherwise undefined

state$: Observable<FutureUnion<T>>

The state of the Future

value$: Observable<T>

The value of the Future. Won't emit until a value is present

waiting$: Observable<boolean>

True if the Future is in the Loading or Empty state, otherwise false

Methods

  • Parameters

    Returns Unsubscribable