-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add trigger_map to support triggering mapped events #14664
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very elegant solution for Or
-style logic. I've left a small docs suggestion that I think will help clarify the usage.
Would this work well with bubbling since it's being converted into a different event type? I'm imaging a scenario where someone could end up with this in a hierarchy:
|
Alternative here: #14674 |
Objective
Alternative to the suggestion in #14649
Sometimes people want observers to watch for multiple events instead of just one. We should provide some mechanism for this to happen.
Solution
Add a
trigger_map
function, which returns an ObserverSystem that will use a givenmap
function to trigger a mapped event when a certain event type is triggered: