Create a Future

  • Create a Future

    Type Parameters

    • T

    Parameters

    • value$: Observable<undefined | T>

      Values

    • Optionalloading$: Observable<boolean>

      The loading state

    • Optionalerror$: Observable<
          | undefined
          | string
          | boolean
          | Error>

      The error state

    Returns Future<NonNullable<T>>

Future

configure: (<T>(value$: Observable<T>, loading$?: Observable<boolean>, error$?: Observable<
    | undefined
    | string
    | boolean
    | Error>) => FutureConfig<T, T>)

Type declaration

    • <T>(value$, loading$?, error$?): FutureConfig<T, T>
    • Generate a new Future using a config

      Type Parameters

      • T

      Parameters

      • value$: Observable<T>

        Values

      • Optionalloading$: Observable<boolean>

        The loading state

      • Optionalerror$: Observable<
            | undefined
            | string
            | boolean
            | Error>

        The error state

      Returns FutureConfig<T, T>

empty: (() => Future<any>)

Type declaration

fromLoadingState: (<T>(loading: IValueLoadingState<T>) => Future<T>)

Type declaration

fromObservable: (<T>(value$: Subscribable<T>) => Future<T>)

Type declaration

    • <T>(value$): Future<T>
    • Create a Future from a Observable / Subscribable. Will resolve on the first emitted value

      Type Parameters

      • T

      Parameters

      • value$: Subscribable<T>

      Returns Future<T>

fromRequest: (<T>(req: Observable<T>) => Future<T>)

Type declaration

    • <T>(req): Future<T>
    • Create a Future from an Observable

      Type Parameters

      • T

      Parameters

      • req: Observable<T>

      Returns Future<T>