I already know that
The Replay
postfix is pretty obvious, it returns its last emission/s.
Let's take for example an Angular HTTP request with present AND future subscription :
<p>{{ (person | async)?.id }}</p> //present markup
<p *ngIf=”show”>{{ (person | async)?.userId }}</p> <!-- future markup -->
If I don't want multiple http
requests I can use :
publishReplay().Connect()
But I can also use: shareReplay()
, but I'm sure that there is one here that is more correct to use than the other.
Question :
When should I use publishReplay
vs shareReplay
? What will be the difference in terms of that HTTP present & future request?
NB
Why there's no documentation about shareReplay
?
question from:
https://stackoverflow.com/questions/47926240/when-should-i-use-publishreplay-vs-sharereplay 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…