Skip to content

rxjs

import {
  observableFromExome
} from "exome/rxjs";

function observableFromExome

Subscribes to store instance update events and trigger Observable updates accordingly.

function observableFromExome<T extends Exome>(
  store: T,
): Observable<T>;
example.ts
import { observableFromExome } from "exome/rxjs"
import { counterStore } from "./counter.store.ts"
 
observableFromExome(counterStore)
  .pipe(
    map(({ count }) => count),
    distinctUntilChanged()
  )
  .subscribe((value) => {
    console.log("Count changed to", value)
  });
 
setInterval(counterStore.increment, 1000)