Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a Broadcast method #305

Closed
jgrund opened this issue May 20, 2015 · 1 comment
Closed

Implement a Broadcast method #305

jgrund opened this issue May 20, 2015 · 1 comment

Comments

@jgrund
Copy link
Collaborator

jgrund commented May 20, 2015

Follow on from #172.

When working with dynamic views in a UI, I need the ability to fork an existing stream and wire it up to n subviews. n is not a fixed number and oscillates up and down at runtime.

Some of these views will be destroyed at runtime, while others will stay intact. So, the mechanism should handle dynamic creation and removal of forks.

In #172, @vqvu suggested a broadcast method that consumes a stream returns an object with the following interface:

new() - Creates a new viewer stream that sees values emitted by the parent.
destroy() - Destroys the parent. No new viewers can be created after this.

The broadcast#new method returns a viewer which has shared back pressure like a fork, but

  • They can be created dynamically, after data has started flowing.
  • The source does not get destroyed even when there are no viewers.
  • If there are no viewers, the source will be paused.
  • It is up to the user of broadcast to destroy the source once they are done with it.
@jgrund
Copy link
Collaborator Author

jgrund commented Aug 31, 2016

Implemented something like this outside the lib, was easy to do.

This probably doesn't need to be in core.

@jgrund jgrund closed this as completed Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant