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

Find out who triggered an aggregated channel callback #102

Open
claudiu-coman opened this issue Dec 25, 2013 · 4 comments
Open

Find out who triggered an aggregated channel callback #102

claudiu-coman opened this issue Dec 25, 2013 · 4 comments

Comments

@claudiu-coman
Copy link

It would be nice if we knew what channel triggered the callback.

At the moment if you're subscribed to channels A, B, C for example and the callback is triggered, you can't tell where the changes came from. But there might be times when you might want to ignore changes from A after the initial rendering of the widget. You need A to have data in the beginning, but you don't care about it afterwards.

Some flag on each of the channels indicating whether or not the callback was triggered by them would help a lot.

@palcu
Copy link

palcu commented Dec 26, 2013

👍 I had the same problem while debugging. However, I don't know how this should be fixed.

@aismail
Copy link
Contributor

aismail commented Dec 26, 2013

great use-case! I'll whip up a solution and come back to you

@aismail
Copy link
Contributor

aismail commented Dec 26, 2013

Who wants to implement this with a test-case? I propose an extra parameter for the aggregated channels callback, called 'cause', that will be the last one (thus optional).

Here is where we call the callback (and see a few lines above that for the second use-case). It's very simple to add the 'cause', because you have the channel triggering the callback.

@ovidiuch
Copy link
Contributor

ovidiuch commented Jan 6, 2014

Good find, I'm sure I needed this more than once. I'm still wrapping my head around the design pattern implications, but the solution @aismail proposed is quite slick as it doesn't alter any previous code and is easy to implement.

@claudiu-coman you could create the pull request yourself if you want to give it a shot, we're here to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants