Comments (2)
Hi @adosikas,
Timers are designed to behave like UI elements, such that once they are removed from the page, they are no longer active. The other concept to keep in mind is that new elements are always placed in the current context. In case of a button click this is the button's parent slot. So if you create a timer inside a click handler and clear the parent container afterwards, the timer never runs. You can move the line with ui.timer
further down so that it gets added as a new element to the cleared container. Or you create the timer somewhere further up in the DOM, e.g. in the client's page
or layout
element:
with ui.context.client.layout:
ui.timer(0.5, lambda: ui.notify("This lambda never runs"), once=True)
We'll have to think about how we can avoid this confusion. A detach
parameter might be an option.
from nicegui.
I created feature request #3225 to discuss a non-ui app.timer
.
from nicegui.
Related Issues (20)
- RuntimeError: app.storage.user needs a storage_secret passed in ui.run() HOT 8
- on air not working from UK HOT 2
- Make `client.ip` available before socket connection is established
- Input unable to add forward slash (/) when it is bind to path HOT 2
- on_upload doesn't seem to be working HOT 10
- Connection lost within 3 seconds when app is deployed on kubernetes HOT 1
- TypeError: Client.__init__() missing 1 required keyword-only argument: 'request' HOT 5
- Pytest for pages with a URL other than root ("/") fail. HOT 2
- Tooltip HOT 4
- ui.clipboard.read does not work in Safari and native mode on Mac HOT 1
- ui.number displayed number format not maintained HOT 1
- Tooltip not working with ui.upload component HOT 2
- ui.codemirror not updating when the binded dictionary changes HOT 3
- 3D objects get stuck in scene when reloading. HOT 1
- Updating Ploty chart with a large dataset causes the UI to hang HOT 6
- ui.select() dropdown width unexpected behaviour
- Reloading is very slow HOT 10
- `True (error) or False (no error)` in `Input validation` should be `True (no error) or False (error)` HOT 1
- How to cut startup time in half while native=True. HOT 2
- [WinError 10013] at start (Problem binding to port 80?) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nicegui.