ReactiveX / rxjs

A reactive programming library for JavaScript
https://rxjs.dev
Apache License 2.0
30.7k stars 3k forks source link

.shareReplay operator? #1194

Closed justinwoo closed 8 years ago

justinwoo commented 8 years ago

Should we have this operator? People could just ReplaySubject, but maybe this is nice to have.

Might require replay to be implemented if this were added though (which, iirc, just uses ReplaySubject under the hood anyway).

shareReplay in RxJS4

kwonoj commented 8 years ago

There's long discussions in https://github.com/ReactiveX/RxJS/issues/453, shorthanded summary's at https://github.com/ReactiveX/RxJS/issues/1110 also.

kwonoj commented 8 years ago

In short, for now shareReplay is not added and it's expected.

justinwoo commented 8 years ago

Oh, sorry, didn't find it in the search results.

kwonoj commented 8 years ago

@justinwoo Don't feel sorry, I also feel searching issue in github is bit hard sometime :) Glad questions solved.

staltz commented 8 years ago

.publishReplay().refCount()

benlesh commented 8 years ago

We should have something similar ... but I'm not sure I'd want to name it shareWhatever at this point. share() has a slightly different and more ergonomic behavior than publish().refCount(). I'd like to add some sort of cache() operator that does what shareReplay was used for, but with perhaps more extensible arguments than a simple count to control things like expirey, etc. We started some discussion in #839 but it petered out.

staltz commented 8 years ago

I think we sort of agreed to cut the excess in share operators, and I like it if people understand what a ConnectableObservable is and that you need to call "connect()" and how refCount is sort of auto-connect. Because share() can sometimes be understood as a blurred concept of "make this cold become hot".

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.