-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
SvelteDate.now()
as a live updating source
#12441
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
Comments
How often would this try to update? Every millisecond? I don't know how to do this automatically in a sane way. |
It would use svelte's internal requestAnimationFrame loop |
Svelte does not have an update loop, it only updates the DOM when things have been changed, the change being the trigger. |
I don't think this makes sense - it would bring down performance because it would update at an insane rate, when in reality you're likely only interested in every second/minute/etc. Much better to decide the interval yourself and trigger updates at the appropriate times. |
Here's what I'm talking about: https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/internal/client/loop.js |
That is for transitions/animations. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the problem
There's a lot of boilerplate required to make a
$state
that always refers to the current date.Describe the proposed solution
It would be cool to be able to do this:
Naive REPL example
Importance
nice to have
The text was updated successfully, but these errors were encountered: