-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Improve event registration #1095
Conversation
I found a way to define, which event arguments should be included, that is easy to use and backward-compatible:
If the retrieved list of event arguments has length 1, the argument is automatically unpacked. So you can write ui.button().on('click', lambda e: print(e.args['clientX'], flush=True)) instead of ui.button().on('click', lambda e: print(e.args[0]['clientX'], flush=True)) Note that by default all JSON-serializable attributes of all arguments are sent. This is to simplify registering for new events and discovering their attributes. If bandwidth is an issue, the arguments should be limited to what is actually needed on the server. |
Looks super cool. I think we should add some in-detail documentation about the |
This PR attempts to improve the generic event registration with the
.on()
method.clientX
for "click" on a label.on
pass information about sender: addmsg: Dict[str, Any]
toEventArguments
.on Event for Element doesn't pass information to callback about sender #583
row
andindex
for "rowClick" on a tableImprove access to event arguments #672
more
arguments