nucleus icon indicating copy to clipboard operation
nucleus copied to clipboard

add DeliverLatest

Open kanat opened this issue 8 years ago • 2 comments

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)

kanat avatar Jan 14 '17 07:01 kanat

hi, why not just use Observable.last() operator together with deliveryFirst?

konmik avatar Jan 23 '17 21:01 konmik

Oh, I understood why. I need to think a little bit :)

konmik avatar Jan 23 '17 21:01 konmik