Timer class to get callback called #399
markusgritsch
started this conversation in
Feature Request
Replies: 1 comment
-
Great suggestion. In fact, I ran into the same problem, with one of my projects. I had an idea for timers too but with a different approach. My idea is to have generic timer topics, that work like cron-jobs, you can subscribe to. from lona import Channel
def my_update_code(channel, message):
# gets called every 30sec
pass
# format: "timer.{hour}.{minute}.{second}"
timer = Channel('timer.*:*:/30', my_update_code) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I want to periodically update some Browser content, I need to add an endless loop at the end of
handle_request()
like this:When updating different things at different intervals, the necessary manual dispatching quickly becomes cumbersome.
From Qt I'm used to be able to us a QTimer object to call a callback method, either periodically, or just one time in single-shot mode.
What do you think about such a class for Lona?
NiceGUI also seems to have something similar: https://nicegui.io/documentation/timer
Beta Was this translation helpful? Give feedback.
All reactions