Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @crikey/stores-rxjs

@crikey/stores-rxjs

Simple conversion functions to allow interop of Svelte style stores with RxJS style stores

API

Store creation functions:

Promise creation functions:

  • {@link promise} - Create a Promise instance which tracks the state from a readable store containing a promise state

Installation

# pnpm
$ pnpm add @crikey/stores-rxjs

# npm
$ npm add @crikey/stores-rxjs

# yarn
$ yarn add @crikey/stores-rxjs

Index

Functions

  • observe_store<T>(store: Readable): BehaviorSubject<T>
  • Create an observable from the given store. The observable will emit a signal for the initial store value as well as all subsequent changes

    Type parameters

    • T

    Parameters

    • store: Readable

      the store to create an observable from

    Returns BehaviorSubject<T>

  • readable<T>(observable: Observable<T>): Readable
  • readable<T>(observable: Observable<T>, initial_value: T): Readable
  • readable<T>(observable: Observable<T>, initial_value?: T): Readable
  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with undefined upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Each new subscription to the created store will create a new subscription to the underlying observable. "This shows how subscribe calls are not shared among multiple Observers of the same Observable. When calling observable.subscribe with an Observer, the function subscribe in new Observable(function subscribe(subscriber) {...}) is run for that given subscriber. Each call to observable.subscribe triggers its own independent setup for that given subscriber."

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    Returns Readable

  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with initial_value upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Each new subscription to the created store will create a new subscription to the underlying observable. "This shows how subscribe calls are not shared among multiple Observers of the same Observable. When calling observable.subscribe with an Observer, the function subscribe in new Observable(function subscribe(subscriber) {...}) is run for that given subscriber. Each call to observable.subscribe triggers its own independent setup for that given subscriber."

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    • initial_value: T

      initial_value to signal with if the observable doesn't immediately signal a value

    Returns Readable

  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with initial_value upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Each new subscription to the created store will create a new subscription to the underlying observable. "This shows how subscribe calls are not shared among multiple Observers of the same Observable. When calling observable.subscribe with an Observer, the function subscribe in new Observable(function subscribe(subscriber) {...}) is run for that given subscriber. Each call to observable.subscribe triggers its own independent setup for that given subscriber."

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    • Optional initial_value: T

      initial_value to signal with if the observable doesn't immediately signal a value

    Returns Readable

  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with undefined upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Upon initial subscription, the store will begin receiving signals from the observer and continue until manually unlinked. Unlike traditional RxJS observables, signals originating from the constructor will not be re-sent.

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    Returns Readable & Linkable & Unlinkable

  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with undefined upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Upon initial subscription, the store will begin receiving signals from the observer and continue until manually unlinked. Unlike traditional RxJS observables, signals originating from the constructor will not be re-sent.

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    • initial_value: T

      initial_value to signal with if the observable doesn't immediately signal a value

    Returns Readable & Linkable & Unlinkable

  • Convert an RxJS Observable to a svelte compatible store. note: subscribers will be signaled with undefined upon subscription unless the observable fires a signal synchronously note: RxJs Observables do not support the necessary constructs to avoid the diamond dependency problem note: Upon initial subscription, the store will begin receiving signals from the observer and continue until manually unlinked. Unlike traditional RxJS observables, signals originating from the constructor will not be re-sent.

    Type parameters

    • T

    Parameters

    • observable: Observable<T>

      observable to convert into a store

    • Optional initial_value: T

      initial_value to signal with if the observable doesn't immediately signal a value

    Returns Readable & Linkable & Unlinkable

Generated using TypeDoc