State container that represents the asynchrony of a trackedFunction

Type Parameters

  • Value

Constructors

Properties

data: null | Pending<Value> | Resolved<Value> | Rejected<Value> = null
promise: Value

Accessors

  • get error(): null | {}
  • When the function passed to trackedFunction throws an error, that error will be the value returned by this property

    Returns null | {}

  • get value(): null | Awaited<Value>
  • this.data may not exist yet.

    Additionally, prior iterations of TrackedAsyncData did not allow the accessing of data before .state === 'RESOLVED' (isResolved).

    From a correctness standpoint, this is perfectly reasonable, as it forces folks to handle the states involved with async functions.

    The original version of trackedFunction did not use TrackedAsyncData, and did not have these strictnesses upon property access, leaving folks to be as correct or as fast/prototype-y as they wished.

    For now, trackedFunction will retain that flexibility.

    Returns null | Awaited<Value>

Methods

  • Will re-invoke the function passed to trackedFunction this will also re-set some properties on the State instance. This is the same State instance as before, as the State instance is tied to the fn passed to trackedFunction

    error or resolvedValue will remain as they were previously until this promise resolves, and then they'll be updated to the new values.

    Returns Promise<undefined | Value>

Generated using TypeDoc