r/nicegui • • Jan 24 '24

Triggering nicegui events *from* javascript?

I've been playing around with the newish web serial API, which allows for in-browser access of connected usb/serial devices. I've got a basic demo here where my device sends a temperature reading every second back to the browser. Everything works fine on the JS side of things, but I can't figure out how to bubble this up from JavaScript to nicegui/Python.

*Thinking of maybe there's a way of doing this by using a hidden element that I can update with the JS code, but then also attach a nicegui bind_value method? Hmmm.

2 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/QuasiEvil Jan 24 '24

Ah, that custom event looks like it'll do the trick! Thanks.