Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "hs/async/index"

Index

Type aliases

AsyncResult

AsyncResult: [HyperValue<T | I>, HyperValue<PromiseState>, HyperValue<any>]

the result of async helper is an array contains of 3 elements:

  1. result hyper-value. it's set to a new value according to get, set and update;
  2. state hyper-value. it's set to the Promise state;
  3. error hyper-value; it's set to undefined when everything is fine, or to an error if it occurs; it's recommended to use es6 array destructuring for usage. e.g. const [result, state] = async(...);

PromiseState

PromiseState: "pending" | "resolved" | "rejected"

Functions

async

  • Works similarly to auto but takes asynchronous functions. It takes a function, run it and returns a hyper-value that eventually will be equal to resolved result of the function.

    Type parameters

    • T

      represents the type of hyper-value after resolving

    • I

      represents the initial type of hyper-value; if no initial value provided it's undefined

    Parameters

    • hs: HyperScope

      HyperScope instance

    • params: HvAsyncParams<T, I>

      an object containing all possible params

    Returns AsyncResult<T, I>

Generated using TypeDoc