slint/examples/printerdemo/node/main.js
Simon Hausmann 5f265ffc09 Split up ComponentWindow::run() into show(), hide() and sixtyfps::run_event_loop()
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.

As a bonus, the run() function on generated components is not consuming
anymore.
2021-01-19 09:50:22 +01:00

33 lines
1 KiB
JavaScript

#!/usr/bin/env node
/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
// import "sixtyfps";
require("sixtyfps");
// import * as demo from "../ui/printerdemo.60";
let demo = require("../ui/printerdemo.60");
let 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 }];
window.fax_number_erase.setHandler(function () {
window.fax_number = window.fax_number.substring(0, window.fax_number.length - 1);
})
window.fax_send.setHandler(function () {
console.log("Send fax to " + window.fax_number);
window.fax_number = "";
})
window.run();