question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delaying until another observable emits

See original GitHub issue

I have two observables (of different types), let’s say Observable<Widget> and Observable<Gadget>. I’m only ever going to get one Widget, but until I do get that Widget and take appropriate initialization action, I don’t want to receive any Gadgets. Once the Widget has been received, I want all Gadgets to be emitted as fast as possible, and then all subsequent Gadgets to be emitted whenever they arrive.

Is there a tidy way to do this with existing API? The best way I found after a little looking was a Subscriber implementation that would buffer Gadgets in a list until instructed to stop buffering (done via a subscriber on our Widget observable in this example). Upon said state change, the subscriber would emit all buffered objects into another Observer, and simply forward all subsequent objects to the Observable as well. This wasn’t very satisfying, though.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marshallpiercecommented, Jan 26, 2015

Doh, sorry for forgetting about this. This also doesn’t seem to demonstrate (or handle) saving events that happen before source1 emits.

0reactions
akarnokdcommented, Jan 26, 2015

Closing due to inactivity. If you have further questions, please reopen this issue or create a new one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RxJS buffer and delay until one other observable emit first time
My question is, how can I delay historyStream$ occurrences as long as deviceVersionModelStream$ emit one time (it's a HOT one too used on...
Read more >
delayWhen - RxJS Reference | indepth.dev
delayWhen delays each emitted value from the source observable by a time span determined by another observable referred to as duration observable. When...
Read more >
delayWhen - RxJS
Delays the emission of items from the source Observable by a given time span determined by the emissions of another Observable.
Read more >
rxjs - buffer emitted values until other observable emits, then ...
Coding example for the question rxjs - buffer emitted values until other observable emits, then emit as normal-rx.js.
Read more >
RxJS: inserting a delay between each item of a stream / btheado
Based on its name, the RxJS delay operator sounds promising. ... It waits for each stream to have a value before emitting any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found