mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-26 21:34:08 +00:00
26 lines
684 B
JavaScript
26 lines
684 B
JavaScript
#!/usr/bin/env node
|
|
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import * as slint from "slint-ui";
|
|
|
|
const ui = slint.loadFile("../ui/demo.slint");
|
|
const window = new ui.AppWindow();
|
|
const api = window.Api;
|
|
const date = api.current_date;
|
|
const time = api.current_time;
|
|
|
|
const timer = setInterval(() => {
|
|
const now = new Date();
|
|
date.year = now.getFullYear();
|
|
date.month = now.getMonth() + 1;
|
|
date.day = now.getDate();
|
|
api.current_date = date;
|
|
time.hour = now.getHours();
|
|
time.minute = now.getMinutes();
|
|
time.second = now.getSeconds();
|
|
api.current_time = time;
|
|
}, 1000);
|
|
|
|
await window.run();
|
|
clearInterval(timer);
|