Class IRequestStateAbstract

A class representing the state of a request

Hierarchy (view full)

Implements

  • Subscribable<unknown>

Constructors

Properties

error: Signal<undefined | Error>

Emits the error if one is thrown by the request. Otherwise undefined

failed: Signal<boolean>

Emits true if the request failed

loading: Signal<boolean>

Emits true when the request is running

request$: Observable<unknown>

The underlying request

result: Signal<unknown>

The result of the request, or undefined when unresolved

result$: Observable<unknown>

The result of the request

Methods

  • Perform an action if the request fails

    Parameters

    • onError: ((error: Error) => void)
        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns this

  • Perform an action when the request finishes (Error or Success)

    Parameters

    • onComplete: ((error?: Error) => void)
        • (error?): void
        • Parameters

          • Optionalerror: Error

          Returns void

    Returns this

  • Subscribe to the underlying request Observable

    Parameters

    • observer: Partial<Observer<unknown>>

    Returns Unsubscribable

  • Perform actions when the request finishes

    Parameters

    • onValue: ((value: unknown) => void)

      Action to perform on successful resolution

        • (value): void
        • Parameters

          • value: unknown

          Returns void

    • OptionalonError: ((error: Error) => void)

      Action to perform on error

        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns this