nucleus
nucleus copied to clipboard
add DeliverLatest
Hi.
DeliverLatest completes automatically when the source observable is done.
In my case I have a Repository which emits data from Cache, DB and API. I can emit from Cache first, then from DB and API. It's a sequence of distinct items.
Why I'm not using deliveryLatestCache?
- to avoid keeping subscription to viewObservable
- to avoid getting the last cache from observable, cause it can be incorrect (old)
Why I'm not using deliveryFirst?
- it will emit only first item (from Cache)
Why I'm not using deliveryReplay?
- the item sequence in ReplaySubject might be outdated and I want just to get the new sequence from Repository (it's already got own cache)
hi, why not just use Observable.last()
operator together with deliveryFirst
?
Oh, I understood why. I need to think a little bit :)