Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "promisedComputed"

Index

Type aliases

PromiseResult

PromiseResult<T>: { ok: true; value: T } | { error: any; ok: false }

Type parameters

  • T

Functions

error

  • Type parameters

    • T

    Parameters

    • error: any

    Returns PromiseResult<T>

isPromiseLike

  • isPromiseLike<T>(result: PromiseLike<T> | T): result is PromiseLike<T>
  • Type parameters

    • T

    Parameters

    • result: PromiseLike<T> | T

    Returns result is PromiseLike<T>

promisedComputed

  • Similar to the standard computed, except that it converts promises into plain values, unwrapping them when they resolve and updating to the new value. The supplied function may return a plain value in which case the update is entirely synchronous like standard computed.

    As with the standard computed, exceptions (and rejected promises) are propagated as re-thrown exceptions. To avoid this, perform your own error handling in your supplied function.

    Type parameters

    • T

    Parameters

    • init: T

      Value to assume until the promise first resolves

    • compute: () => PromiseLike<T> | T

      Evaluates to a promised or plain value

        • (): PromiseLike<T> | T
        • Returns PromiseLike<T> | T

    Returns PromisedComputedValue<T>

promisedComputedInternal

  • Type parameters

    • T

    Parameters

    • init: T
    • compute: () => PromiseLike<T> | T
        • (): PromiseLike<T> | T
        • Returns PromiseLike<T> | T

    Returns PromisedComputedValue<T>

value

  • Type parameters

    • T

    Parameters

    • value: T

    Returns PromiseResult<T>

Generated using TypeDoc