Cookbook / Clock

Clock

display

Real-time clock — onMount starts the interval, onDispose clears it; tick runs through an action.

id
aihu-clock
since
0.5.0
file
aihu-clock.aihu
stateactiononMountonDisposeinterpolation

Run it

source · static

This recipe doesn't have a hydrated island in the demo gallery yet. An in-browser, WASM-compiled playground (edit this source and re-render live) is planned as a follow-up — read the real source below.

Source

aihu-clock.aihu

Requires

concerns
state

Anti-patterns

  • Do not start timers at @state top level — setup also runs during SSR; start them in onMount and always clear them in onDispose.

Related recipes