Options
All
  • Public
  • Public/Protected
  • All
Menu

Package remote-data

@typed/remote-data

Data-type for working with data that comes in asynchronously.

Index

Type aliases

Loadable

Loadable<A, B>: Exclude<RemoteData<A, B>, NoData>

Type parameters

  • A

  • B

Loaded

Loaded<A, B>: Failure<A> | Success<B>

Type parameters

  • A

  • B

Loading

Loading: { status: Loading }

Type declaration

NoData

NoData: { status: NoData }

Type declaration

Refreshing

Refreshing<A, B>: RefreshingFailure<A> | RefreshingSuccess<B>

Type parameters

  • A

  • B

Variables

Const ap

ap: { <A, B, C>(fn: RemoteData<A, (value: B, refreshing: boolean) => C>, value: RemoteData<A, B>): RemoteData<A, C>; <A, B, C>(fn: RemoteData<A, (value: B, refreshing: boolean) => C>): (value: RemoteData<A, B>) => RemoteData<A, C> } = curry(__ap) as {<A, B, C>(fn: RemoteData<A, (value: B, refreshing: boolean) => C>,value: RemoteData<A, B>,): RemoteData<A, C><A, B, C>(fn: RemoteData<A, (value: B, refreshing: boolean) => C>): (value: RemoteData<A, B>,) => RemoteData<A, C>}

Applies the function contains in an RemoteData to the value contained in a second RemoteData.

name

ap<A, B, C>(fn: RemoteData<A, (value: B, refreshing: boolean) => C>, value: RemoteData<A, B>): RemoteData<A, C>

Type declaration

Const chain

chain: { <A, B, C>(f: (value: B, refreshing: boolean) => RemoteData<A, C>, data: RemoteData<A, B>): RemoteData<A, C>; <A, B, C>(f: (value: B, refreshing: boolean) => RemoteData<A, C>): (data: RemoteData<A, B>) => RemoteData<A, C> } = curry(__chain) as {<A, B, C>(f: (value: B, refreshing: boolean) => RemoteData<A, C>,data: RemoteData<A, B>,): RemoteData<A, C><A, B, C>(f: (value: B, refreshing: boolean) => RemoteData<A, C>): (data: RemoteData<A, B>,) => RemoteData<A, C>}

Returns a RemoteData that is the result of calling f with the resolved value of another RemoteData.

name

chain<A, B, C>(f: (value: B, refreshing: boolean) => RemoteData<A, C>, data: RemoteData<A, B>): RemoteData

Type declaration

Const map

map: { <A, B, C>(f: (value: B, refreshing: boolean) => C, data: RemoteData<A, B>): RemoteData<A, C>; <A, B, C>(f: (value: B, refreshing: boolean) => C): (data: RemoteData<A, B>) => RemoteData<A, C> } = curry(__map) as {<A, B, C>(f: (value: B, refreshing: boolean) => C, data: RemoteData<A, B>): RemoteData<A, C><A, B, C>(f: (value: B, refreshing: boolean) => C): (data: RemoteData<A, B>) => RemoteData<A, C>}

Map over the value of a successful RemoteData.

name

map<A, B, C>(f: (value: B, refreshing: boolean) => C,, data: RemoteData<A, B>): RemoteData<A, C>

Type declaration

    • Type parameters

      • A

      • B

      • C

      Parameters

      • f: (value: B, refreshing: boolean) => C
          • (value: B, refreshing: boolean): C
          • Parameters

            • value: B
            • refreshing: boolean

            Returns C

      • data: RemoteData<A, B>

      Returns RemoteData<A, C>

    • Type parameters

      • A

      • B

      • C

      Parameters

      • f: (value: B, refreshing: boolean) => C
          • (value: B, refreshing: boolean): C
          • Parameters

            • value: B
            • refreshing: boolean

            Returns C

      Returns (data: RemoteData<A, B>) => RemoteData<A, C>

Const unpack

unpack: { <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }; <C>(noData: () => C, loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } }; <C>(noData: () => C): { <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A, B>(loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }; (loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } } } } = curry(__unpackRemoteData)

Type declaration

    • <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C
    • <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
    • <A, B, C>(noData: () => C, loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }
    • <C>(noData: () => C, loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } }
    • <C>(noData: () => C): { <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A, B>(loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }; (loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } } }
    • Type parameters

      • A

      • B

      • C

      Parameters

      • noData: () => C
          • (): C
          • Returns C

      • loading: () => C
          • (): C
          • Returns C

      • failure: (value: A) => C
          • (value: A): C
          • Parameters

            • value: A

            Returns C

      • success: (value: B) => C
          • (value: B): C
          • Parameters

            • value: B

            Returns C

      • remoteData: RemoteData<A, B>

      Returns C

    • Type parameters

      • A

      • B

      • C

      Parameters

      • noData: () => C
          • (): C
          • Returns C

      • loading: () => C
          • (): C
          • Returns C

      • failure: (value: A) => C
          • (value: A): C
          • Parameters

            • value: A

            Returns C

      • success: (value: B) => C
          • (value: B): C
          • Parameters

            • value: B

            Returns C

      Returns (remoteData: RemoteData<A, B>) => C

    • Type parameters

      • A

      • B

      • C

      Parameters

      • noData: () => C
          • (): C
          • Returns C

      • loading: () => C
          • (): C
          • Returns C

      • failure: (value: A) => C
          • (value: A): C
          • Parameters

            • value: A

            Returns C

      Returns { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }

        • (success: (value: B) => C, remoteData: RemoteData<A, B>): C
        • (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
        • Parameters

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          • remoteData: RemoteData<A, B>

          Returns C

        • Parameters

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          Returns (remoteData: RemoteData<A, B>) => C

    • Type parameters

      • C

      Parameters

      • noData: () => C
          • (): C
          • Returns C

      • loading: () => C
          • (): C
          • Returns C

      Returns { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } }

        • <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C
        • <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
        • <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }
        • Type parameters

          • A

          • B

          Parameters

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          • remoteData: RemoteData<A, B>

          Returns C

        • Type parameters

          • A

          • B

          Parameters

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          Returns (remoteData: RemoteData<A, B>) => C

        • Type parameters

          • A

          Parameters

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          Returns { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }

            • <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C
            • <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
            • Type parameters

              • B

              Parameters

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              • remoteData: RemoteData<A, B>

              Returns C

            • Type parameters

              • B

              Parameters

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              Returns (remoteData: RemoteData<A, B>) => C

    • Type parameters

      • C

      Parameters

      • noData: () => C
          • (): C
          • Returns C

      Returns { <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A, B>(loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }; (loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } } }

        • <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C
        • <A, B>(loading: () => C, failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
        • <A, B>(loading: () => C, failure: (value: A) => C): { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }
        • (loading: () => C): { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } }
        • Type parameters

          • A

          • B

          Parameters

          • loading: () => C
              • (): C
              • Returns C

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          • remoteData: RemoteData<A, B>

          Returns C

        • Type parameters

          • A

          • B

          Parameters

          • loading: () => C
              • (): C
              • Returns C

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          • success: (value: B) => C
              • (value: B): C
              • Parameters

                • value: B

                Returns C

          Returns (remoteData: RemoteData<A, B>) => C

        • Type parameters

          • A

          • B

          Parameters

          • loading: () => C
              • (): C
              • Returns C

          • failure: (value: A) => C
              • (value: A): C
              • Parameters

                • value: A

                Returns C

          Returns { (success: (value: B) => C, remoteData: RemoteData<A, B>): C; (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }

            • (success: (value: B) => C, remoteData: RemoteData<A, B>): C
            • (success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
            • Parameters

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              • remoteData: RemoteData<A, B>

              Returns C

            • Parameters

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              Returns (remoteData: RemoteData<A, B>) => C

        • Parameters

          • loading: () => C
              • (): C
              • Returns C

          Returns { <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C; <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C; <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C } }

            • <A, B>(failure: (value: A) => C, success: (value: B) => C, remoteData: RemoteData<A, B>): C
            • <A, B>(failure: (value: A) => C, success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
            • <A>(failure: (value: A) => C): { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }
            • Type parameters

              • A

              • B

              Parameters

              • failure: (value: A) => C
                  • (value: A): C
                  • Parameters

                    • value: A

                    Returns C

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              • remoteData: RemoteData<A, B>

              Returns C

            • Type parameters

              • A

              • B

              Parameters

              • failure: (value: A) => C
                  • (value: A): C
                  • Parameters

                    • value: A

                    Returns C

              • success: (value: B) => C
                  • (value: B): C
                  • Parameters

                    • value: B

                    Returns C

              Returns (remoteData: RemoteData<A, B>) => C

            • Type parameters

              • A

              Parameters

              • failure: (value: A) => C
                  • (value: A): C
                  • Parameters

                    • value: A

                    Returns C

              Returns { <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C; <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C }

                • <B>(success: (value: B) => C, remoteData: RemoteData<A, B>): C
                • <B>(success: (value: B) => C): (remoteData: RemoteData<A, B>) => C
                • Type parameters

                  • B

                  Parameters

                  • success: (value: B) => C
                      • (value: B): C
                      • Parameters

                        • value: B

                        Returns C

                  • remoteData: RemoteData<A, B>

                  Returns C

                • Type parameters

                  • B

                  Parameters

                  • success: (value: B) => C
                      • (value: B): C
                      • Parameters

                        • value: B

                        Returns C

                  Returns (remoteData: RemoteData<A, B>) => C

Functions

Const hasNoData

  • hasNoData<A, B>(remoteData: RemoteData<A, B>): remoteData is NoData

Const isDoneLoading

  • isDoneLoading<A, B>(remoteData: RemoteData<A, B>): remoteData is Loaded<A, B>

Const isFailure

  • isFailure<A, B>(remoteData: RemoteData<A, B>): remoteData is Failure<A>

Const isLoading

  • isLoading<A, B>(remoteData: RemoteData<A, B>): remoteData is Loading

Const isRefreshing

  • isRefreshing<A, B>(remoteData: RemoteData<A, B>): remoteData is Refreshing<A, B>

Const isRefreshingFailure

  • isRefreshingFailure<A, B>(remoteData: RemoteData<A, B>): remoteData is RefreshingFailure<A>

Const isRefreshingSuccess

  • isRefreshingSuccess<A, B>(remoteData: RemoteData<A, B>): remoteData is RefreshingSuccess<B>

Const isSuccess

  • isSuccess<A, B>(remoteData: RemoteData<A, B>): remoteData is Success<B>

Object literals

Const Loading

Loading: object

status

status: Loading = RemoteDataStatus.Loading

Const NoData

NoData: object

status

status: NoData = RemoteDataStatus.NoData

Generated using TypeDoc