-
Notifications
You must be signed in to change notification settings - Fork 330
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
Join parallel listeners to one #28
Conversation
Add Reflux.all to track the status of multiple listenables. All listenables must have emitted at least one. Fixes #27
@spoike I will extend the README once I got confirmation that the proposed changes are okay. |
We should probably have a test case that goes like this as well: action1('a');
action3('c');
action1('x'); // should this argument be discarded or replaced?
action2('b'); The question remains is if we should discard the second call with We could decide the simplest solution to be the default behaviour and the other settable through an option? |
Could also throw an error if this is an undesired behavior for the user, i.e. have that as an option for the user developer to provide a fail-fast way to indicate an action is invoked or a store is triggering itself out of intended order. |
I went with the last call as I believe that you should only be interested in the last state. At least I cannot come up with a use case where you would want to observe a group of listenables and read all the states. This might also be out-of-scope for Reflux, no?
This may be a valid extension to this, especially the rejection when one action is called multiple times. |
The last state option is okay with me. We can handle the rejection error throwing idea in another PR. |
If might look something like this:
Possible strategies:trackLastCallThis is the current behavior and I think it should be the default. Given the
the combined action would emit with the following arguments:
trackFirstCallGiven the test case:
the combined action would emit with the following arguments:
trackAllCallsGiven the test case:
the combined action would emit with the following arguments:
ensureEqualNumberOfCallsGiven the test case:
the combined action would not emit, but throw an exception saying that |
Now that I am seeing this, I would say that we should do this in separate PR 😃 |
I'm okay with this PR as it is. Though I'll be waiting with merging things together for a 0.1.6 until we have circular dependency tracking. Lets take the tracking strategies in another PR... |
Okay. I will add some documentation and the test case you mentioned. |
@spoike Please check the README. I listed a few differences to |
Just added an h4 now even though I am not quite happy with this. It would be great if we had a top level section that would describe the difference between Flux and Reflux. Maybe we create such a section once #26, #27 and #28 have landed in master. |
@bripkens I agree with having a top level section explaining the major differences in this regard. I will most likely edit the README later on once I get the ghpages up and running for the project. This feature is an important key point I believe. I hope users of Reflux will agree on this as well. |
Is merged into #34 |
Add Reflux.all to track the status of multiple listenables.
All listenables must have emitted at least one.
Fixes #27