The other day I needed a digital clock-component, so I quickly composed a simple JavaScript-method:
function uiDigitalClock(node) {
const now...
For further actions, you may consider blocking this person and/or reporting abuse
Nice article.
It's funny how the
setTimeout
solution is clearly running slower than the others in the demo. It gets behind in just a few seconds.Thank you! I think stable timing in JS is difficult — once I tried to make a drum sequencer, but the timing was off after random amounts of time!
Have you tried using
requestAnimationFrame
but tracking the dates with counters, only callingDate()
after X ticks to make sure the clock is on time? I think that may be the most accurate (and efficient?) of all the methods.No, but good idea! For the drum-sequencer, I think I ended up using the AudioContext as the “timing source of truth”.
You have to take the drift of the
setTimeout()
into account when you schedule the next frame. See:JavaScript counters the hard way - HTTP 203 - YouTube
You’ve seen loads of counter tutorials online, but they’re all a bit wrong… or at least most of them are. Jake and Surma dissect different techniques and ide...
Interesting to use
performance.now
, I’ve only seen that used in testing. Thanks for sharing!Really nice article. I never would have thought to try using CSS for this, very creative.
Keep up the awesome work!
Thank you!
This is very inspiring, how we can make performant components without moment.js, thank you for sharing! I will try to implement this by myself. But I have a question - why did u decide to consult with Bard? Is it better than chapt GPT?
Thank you! Bard: No particular reason, just trying it out, comparing code-suggestions with chatGPT etc.
Okay, got it! :)
Great article. One of these days, we'll have a CSS-only frontend framework out there.
Thank you!
hopefully...
Really nice thank you
جيد جدا
شكرا لك!
Hope Apple Translate did it properly 😉
Really insightful and well broken down. Thanks!
Thank you!
This is awesome 💖 Loved your writing style and presenting your analysis throughout, like a journey. This is definitely something I can use for focusdoro.app
Kudos!
Thank you! Happy to hear that!
J'ai aimé votre article je me suis exercer à faire la même chose... Merci beaucoup
Merci
Vous êtes un dev front-end ?
Yes, since 1995 — when it was called "webmaster / web-developer" 😂
Moi je débuté cette année avec JavaScript du côté back-end
You got a nice writing style! :-)
Happy to hear that, thank you!
Absolutely fabulous !
Thank you!
I learned how pseudo elements can really make your website pop.
Nice article.
This clock turned out amazing.
Thank you!