import { jsx, VLayout, HLayout, Panel, Gravity, Group, layoutConfig, Text, createRef, Color, loge, } from "doric"; @Entry class Counter extends Panel { build(root: Group) { root.backgroundColor = Color.BLACK; const hour1Ref = createRef(); const hour2Ref = createRef(); const min1Ref = createRef(); const min2Ref = createRef(); const sec1Ref = createRef(); const sec2Ref = createRef(); const comm1Ref = createRef(); const comm2Ref = createRef(); 0 0 : 0 0 : 0 0 ; this.addOnRenderFinishedCallback(async () => { const width = await root.getWidth(this.context); [ hour1Ref, hour2Ref, comm1Ref, min1Ref, min2Ref, comm2Ref, sec1Ref, sec2Ref, ].forEach((e) => { e.current.apply({ border: undefined, textSize: width / 10, }); }); }); setInterval(() => { const time = new Date(); hour1Ref.current.text = `${Math.floor(time.getHours() / 10)}`; hour2Ref.current.text = `${Math.floor(time.getHours() % 10)}`; min1Ref.current.text = `${Math.floor(time.getMinutes() / 10)}`; min2Ref.current.text = `${Math.floor(time.getMinutes() % 10)}`; sec1Ref.current.text = `${Math.floor(time.getSeconds() / 10)}`; sec2Ref.current.text = `${Math.floor(time.getSeconds() % 10)}`; }, 100); } }