Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Computation<T>

An instanciated, cancellable computation from a given Future.

Type parameters

  • T

    the type of the value to be computed.

Hierarchy

  • Computation

Implements

Index

Constructors

constructor

Properties

Private cancelled

cancelled: boolean = false

Private done

done: boolean = false

Private result

result: Promise<T>

Private subscription

subscription: Subscription

Methods

cancel

  • cancel(): void

catch

  • catch<R>(reject?: Reject<R>): Promise<T | R>
  • Register a callback that receives the rejected error.

    Type parameters

    • R

    Parameters

    • Optional reject: Reject<R>

      A callback receiving the rejected error.

    Returns Promise<T | R>

finally

  • finally(action?: Finally): Promise<T>
  • Register a callback that executes after the computation succeeds/fails.

    Parameters

    • Optional action: Finally

      A callback that executes regardless if the computation succeeds or fails.

    Returns Promise<T>

isCancelled

  • isCancelled(): boolean
  • Returns a boolean value which tells if the instance is cancelled.

    Returns boolean

isDone

  • isDone(): boolean
  • Returns a boolean value which tells if the instance has already done computing.

    Returns boolean

then

  • then<S, F>(resolve?: Resolve<T, S>, reject?: Reject<F>): Promise<S | F>
  • Register callbacks that receives resolved value/rejected error.

    Type parameters

    • S

    • F

    Parameters

    • Optional resolve: Resolve<T, S>

      A callback receiving the resolved value.

    • Optional reject: Reject<F>

      A callback receiving the rejected error.

    Returns Promise<S | F>

Generated using TypeDoc