tata668
09-26-2007, 01:20 AM
I'm not sure "bubble" is the correct term, but here's what I'm trying to understand:
Let's say my Application main component contains a custom component A, that contains a custom component B, that contains a custom component C.
Application -> A -> B -> C
Now, let's say an event is dispatched by C.
If I want A to handle that event, do I really need to handle it by B, then having B to dispatch it, and finally having A to handle it? Is there a way to "bubble" the event to A without B handling it and dispatching it too?
I understand at one point you have to say "This is the A method that will be the handler", but I'm not sure how to achieve this when it's a deep component that dispatches the event first.
Is there some kind of pattern about this problem?
If the components were:
Application -> A -> B -> C -> D -> E -> F
What would be the best way to attach an handler on A for an event dispatched by F?
Thanks for any help!
Let's say my Application main component contains a custom component A, that contains a custom component B, that contains a custom component C.
Application -> A -> B -> C
Now, let's say an event is dispatched by C.
If I want A to handle that event, do I really need to handle it by B, then having B to dispatch it, and finally having A to handle it? Is there a way to "bubble" the event to A without B handling it and dispatching it too?
I understand at one point you have to say "This is the A method that will be the handler", but I'm not sure how to achieve this when it's a deep component that dispatches the event first.
Is there some kind of pattern about this problem?
If the components were:
Application -> A -> B -> C -> D -> E -> F
What would be the best way to attach an handler on A for an event dispatched by F?
Thanks for any help!