I've started playing with RxJS5, and now see that there is no longer a shareReplay
method.
It's quite possible that I often misused shareReplay
in RxJS4, but now I'm struggling to get the behaviour that I want, i.e:
- Create an observable
- Subscribe to the observable, and the observable produces a value
- Subscribe to the observable a second time, and I get the same first value
- Observable produces a second value, and both subscriptions get the second value
How do I implement this with RxJS5?
In general I think I understand the RxJS operators quite well, but the whole cold, hot, publish, connect is rather unclear to me. Is there a good reference that shows how to find what kind of observable I have, so that I can find out in a logical manner why a subscribe is not getting values, or why an observable is being executed multiples times?
EDIT
Happy news, shareReplay() is back in RxJS 5.4.0:
Changelog: https://github.com/ReactiveX/rxjs/blob/892700dd4f5d5e5f9ae9276ede32208f4390c5e9/CHANGELOG.md#540-2017-05-09
Barebones documentation: http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-shareReplay
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…