Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @crikey/stores-promise

@crikey/stores-promise

Svelte compatible stores from promises

API

Store creation functions:

  • readable - Create a store tracking the state of a promise
  • derive - Derive a Promise instance from the resolved values of other stores

Promise creation functions:

  • promise - Create a Promise instance which tracks the state from a readable store containing a promise state

Installation

# pnpm
$ pnpm add @crikey/stores-promise

# npm
$ npm add @crikey/stores-promise

# yarn
$ yarn add @crikey/stores-promise

Index

Type aliases

InferInnerType<S>: S extends StatefulPending<infer T> ? T : S extends StatefulFulfilled<infer T> ? T : never

Type parameters

  • S

PromiseCreator<S, T>: (values: StoresValues) => Promise<T>

Type parameters

Type declaration

Type parameters

  • T

Functions

  • Create a readable store that resolves according to the provided promise

    Type parameters

    • T

    Parameters

    • promise: PromiseLike<T>

      promise which resolves into the store value / rejects into the store error

    • Optional initial_value: T

      initial store value

    Returns ReadablePromise<Stateful<T>>

Generated using TypeDoc