node: added url support to loadFile (#6507)

This commit is contained in:
FloVanGH 2024-10-10 11:43:32 +00:00 committed by GitHub
parent be2af11a08
commit f01ac8fc39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 95 additions and 89 deletions

View file

@ -3,17 +3,23 @@
// SPDX-License-Identifier: MIT
import * as slint from "slint-ui";
let demo = slint.loadFile("../ui/printerdemo.slint");
let window = new demo.MainWindow();
const demo = slint.loadFile(
new URL("../ui/printerdemo.slint", import.meta.url),
);
const window = new demo.MainWindow();
window.ink_levels = [
{ color: "#00ffff", level: 0.30 },
{ color: "#ff00ff", level: 0.80 },
{ color: "#ffff00", level: 0.60 },
{ color: "#000000", level: 0.90 }];
{ color: "#00ffff", level: 0.3 },
{ color: "#ff00ff", level: 0.8 },
{ color: "#ffff00", level: 0.6 },
{ color: "#000000", level: 0.9 },
];
window.fax_number_erase = function () {
window.fax_number = window.fax_number.substring(0, window.fax_number.length - 1);
window.fax_number = window.fax_number.substring(
0,
window.fax_number.length - 1,
);
};
window.fax_send = function () {
console.log("Send fax to " + window.fax_number);