Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/modules/state/stateOf"

Index

Type aliases

ObservableLike

ObservableLike<T>: StateObservable<T> | Observable<T>

Either StateObservable or [[Observable]]

Type parameters

  • T

StateObservable

StateObservable<T, U>: keyof [Observable<U>, function, function]

Similar to the what React's useState hook returns but for observables. It's a thruple containing:

  • 0: A stateful observable (see RxJS' BehaviourSubject)
  • 1: A function to update/set the state ($.next(..))
    1. A get state function. ($.getValue())

Type parameters

  • T

  • U

Functions

Const isStateObservable

Const stateOf

  • stateOf :: a -> StateObservable a

    Create a stateful observable. Uses RxJS' BehaviourSubject under the hood.

    Type parameters

    • T

      Type describing the type of the data stored.

    Parameters

    • initialState: T

      Initial state of the observable (see [[BehaviourSubject]])

    Returns StateObservable<T>

Generated using TypeDoc