slint/api/sixtyfps-node
Simon Hausmann 071ab9fda1 Prepare for use of percentages as widths in layouts
Delay the conversion of percentage to the float to code generation type
by inserting the multiplication into the syntax tree. That way we will
be able to detect plain uses of percetages and interpret them
differently.
2020-10-16 15:38:35 +02:00
..
lib Implement basic focus handling 2020-09-25 10:43:47 +02:00
native Prepare for use of percentages as widths in layouts 2020-10-16 15:38:35 +02:00
loader.mjs Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
package.json Fix version in nodejs API package.json 2020-08-25 12:00:43 +02:00
README.md Provide a convenient way to get to the "website" via the docs 2020-08-26 14:46:06 +02:00

SixtyFPS-node

SixtyFPS is a UI toolkit that supports different programming languages. SixtyFPS-node is the integration with node.

Tutorial

require("sixtyfps");
let ui = require("../ui/main.60");
let main = new ui.Main();
main.show();

Example:

See /examples/nodetest

Documentation

By importing the sixtyfps module (or using require), a hook is installed that allows you to import .60 files directly.

let ui = require("../ui/main.60");

Instantiating a component

The exported component is exposed as a type constructor. The type constructor takes as parametter an object which allow to initialize the value of public properties or signals.

// In this example, the main.60 file exports a module which
// has a counter property and a clicked signal
let ui = require("ui/main.60");
let component = new ui.MainWindow({
    counter: 42,
    clicked: function() { console.log("hello"); }
});

Accessing a property

Properties are exposed as properties on the component instance

component.counter = 42;
console.log(component.counter);

Signals

The signals are also exposed as property that can be called

// connect to a signal
component.clicked = function() { console.log("hello"); }
// emit a signal
component.clicked();