A utility to synchronize RxJS observables with external state.
npm install rxjs-sync-withbash
npm i rxjs-sync-with
`
Usage
$3
`ts
import { syncWith, createCrudManager, type Action } from 'rxjs-sync-with';
const manager = createCrudManager((a, b) => a.id === b.id);
const users$ = fetchUsers$.pipe(syncWith(userChanges$, manager));
`
$3
`ts
import { syncWithSingleton } from 'rxjs-sync-with';
const user$ = fetchUser$.pipe(
syncWithSingleton(profileUpdates$, (user, update) => (update ? { ...user, ...update } : user)),
);
`
API
- syncWith(changeFeed$, stateManager)
- syncWithSingleton(changeFeed$, stateManager)
- createCrudManager(compareWith)`