Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Future<T>

A deferred process/computation on a value.

Allows you to compose logic without starting the computation.

To begin a computation, a Future instance must be called with its .get method, which returns a Computation instance.

// Create a Future that resolves the value 'Hello' after 500 ms.
const delayedHello = Future.timer('Hello', 500);

// Begin its computation
const computation = delayedHello.get();

// You can cancel the computation
// computation.cancel();

// Output the resolved value
computation.then(console.log); // 'Hello'

Type parameters

  • T

    type for the computed value

Hierarchy

  • Future

Index

Methods

Methods

compose

Abstract get

pipe

  • Transforms this Future instance by passing it through an array of FutureTransformer functions, wherein the final Future instance is returned.

    Parameters

    • Rest ...transformers: FutureTransformer<any, any>[]

      An array of transformer functions.

    Returns Future<any>

Generated using TypeDoc