DEV Community

Discussion on: Vanilla JavaScript countdown clock

Collapse
 
krhoyt profile image
Kevin Hoyt

First and foremost, congratulations on your engagement! Second, thanks for the post. Maybe it was the occasion, or maybe it was that the content dealt with time (a concept - illusion? - that fascinates me), but I could not help wondering what this might look like as a web component. Third then, is that I reworked it as a web component.

Gist: gist.github.com/krhoyt/4fdb6feb68c...
Demo: temp.kevinhoyt.com/countdown/

I did move from setInterval() to requestAnimationFrame(). I do not know that it adds anything to this specific implementation. Personal preference I suppose. I also made custom style properties available from outside the component. The component also has a couple properties that control some aspects of styling.

Thanks for the inspiration!

Collapse
 
dailydevtips1 profile image
Chris Bongers

Hey Kevin,

Thanks for the congrats, and this awesome web component, looks amazing, really nice work on this!