let __$$app$$__ = __$$hmAppManager$$__.currentApp;
__$$module$$__ = __$$app$$__.current;
let timeSensor = null;
let textWidget = null;
__$$module$$__.module = DeviceRuntimeCore.Page({
onInit() {
timeSensor = hmSensor.createSensor(hmSensor.id.TIME)
textWidget = hmUI.createWidget(hmUI.widget.TEXT, {
x: 15,
y: 200,
w: DEVICE_WIDTH - 42 * 2,
h: 42,
color: 0xffffff,
text_size: 24,
align_h: hmUI.align.CENTER_H,
align_v: hmUI.align.CENTER_V,
text_style: hmUI.text_style.NONE,
text: `${timeSensor.second}`
})
textWidget.addEventListener(hmUI.event.CLICK_DOWN, (info) => {
textWidget.setProperty(hmUI.prop.MORE, {
y: 200
})
})
},
onShow() {
},
onDestroy() {
// On destroy, remove if not required
}
});
I am trying to set the text to
timeSensor.second
. however, it only happens once. How do I fix this