UNPKG

@nozbe/watermelondb

Version:

Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast

18 lines (14 loc) 464 B
// @flow import { type ConnectableObservable, type Observable, ReplaySubject, multicast, } from '../__wmelonRxShim' // Creates a Connectable observable, that, while connected, replays the latest emission // upon subscription. When disconnected, the replay cache is cleared. export default function publishReplayLatestWhileConnected<T>( source: Observable<T>, ): ConnectableObservable<T> { return source.pipe(multicast(() => new ReplaySubject(1))) }