Is it possible to have a kind of BehaviorSubject
with pause and resume switches? Something like PausableBehaviorSubject.pause()
and PausableBehaviorSubject.resume()
? How could that be done?
The idea is that, when paused, the subject would not forward the events received via PausableBehaviorSubject.onNext()
, but instead only store the last one. Upon resuming (or upon subscription, if not paused), the PausableBehaviorSubject
would forward the stored last event (if any) and forward the subsequent events to its subscriber(s).