Skip to content

correct way to jump out event handler #1404

Answered by lo5
zillionare asked this question in Q&A
Discussion options

You must be logged in to vote

The capability to let event handler to decide whether to stop event propagation or not could be a common requirement and it's part of chain of responsibility pattern.

The @on annotation is not modeled after the CoR pattern, since the common usage in Wave is form/menu click handling from different cards. CoR is more suited for event bubbling (in which case your PR for bubble cancellation makes sense).

I would recommend not using @on/handle_on in your case (it's an opt-in feature any way, not the only way to do things, and not suited for your scenario).

Instead, simply process q.args in serve() (or a function called from serve()), in which case you'll have access to the state of your enti…

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by zillionare
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants