@juulsgaard/signal-tools
    Preparing search index...

    Class IValueRequestState<T>Abstract

    A class representing the state of a request with a known return type

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implements

    • Subscribable<T>
    Index

    Constructors

    Properties

    error: Signal<Error | undefined>

    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<T>

    The underlying request

    result: Signal<T | undefined>

    The result of the request, or undefined when unresolved

    result$: Observable<T>

    The result of the request

    Methods

    • Cancel a running request

      Parameters

      • Optionalerror: string | Error | (() => Error)

        Optionally provide a custom error to throw when cancelling the request

      Returns boolean

    • Perform actions when the request finishes

      Parameters

      • onValue: (value: T) => void

        Action to perform on successful resolution

      • OptionalonError: (error: Error) => void

        Action to perform on error

      Returns this