We currently can traverse up the hierarchy via bubbles, which is great!
I think we can extend this by also allowing for sinking - letting an Event propagate down the tree from the calling node.
While this may prove worse in terms of performance (linearly going up the tree vs recursively going down children) for most situations, there are times when having a parent node and propagating events generated on the parent to all the children is a good design choice.
This feature would work like another trait on EntityEvents, : #[can_sink]
This would not block #[can_bubble], and if you define both then your event gets sent both up and down the tree.
We currently can traverse up the hierarchy via bubbles, which is great! I think we can extend this by also allowing for sinking - letting an Event propagate down the tree from the calling node.
While this may prove worse in terms of performance (linearly going up the tree vs recursively going down children) for most situations, there are times when having a parent node and propagating events generated on the parent to all the children is a good design choice.
This feature would work like another trait on EntityEvents, :
#[can_sink]
This would not block
#[can_bubble]
, and if you define both then your event gets sent both up and down the tree.