slint/docs/tutorial/node/src/getting_started.md
Olivier Goffart a565ed53fd Upgrade MSRV to 1.70
Many of our dependencies already made the jump and require a cargo update hack, so make it official

Removed the MSRV from the README since it applies to master branch and people read the readme also for
the released version. There is enough documentation of the MSRV in other locations.
2023-09-06 12:09:03 +02:00

1.9 KiB

Getting Started

In this tutorial, we use JavaScript as the host programming language. We also support other programming languages like Rust or C++.

You'll need a development environment with Node.js 16 and npm installed. More recent versions of NodeJS are currently not supported, for details check Issue #961. Since Slint is implemented in the Rust programming language, you also need to install a Rust compiler (1.70 or newer). You can easily install a Rust compiler following the instruction from the Rust website. You will also need some additional platform-specific dependencies, see https://github.com/slint-ui/slint/blob/master/docs/building.md#prerequisites

We're going to use slint-ui as npm dependency.

In a new directory, we create a new package.json file.

{{#include package.json}}

This should look familiar to people familiar with NodeJS. We see that this package.json references a main.js, which we will add later. We must then create, in the same directory, the memory.slint file. Let's just fill it with a hello world for now:

{{#include memory.slint:main_window}}

What's still missing is the main.js:

{{#include main_initial.js:main}}

To recap, we now have a directory with a package.json, memory.slint, and main.js.

We can now compile and run the program:

npm install
npm start

and a window will appear with the green "Hello World" greeting.

Screenshot of initial tutorial app showing Hello World

Feel free to use your favorite IDE for this purpose.