Closed ogoffart closed 2 weeks ago
Just some general notes, for ffi deno can call into dynamic lib with Deno.dlopen
There are libraries that makes the downloading and caching of the dynamic library automatic for the user https://github.com/denosaurs/plug is the most used
There also higher level wrappers https://github.com/denoland/deno_bindgen
After this pr have landed https://github.com/slint-ui/slint/pull/4357
deno seems to work now with its npm compat (I haven't tested much)
a.ts
import * as slint from "npm:slint-ui@1.4.0-nightly.202411718";
let ui = slint.loadFile("main.slint");
let demo = new ui.Demo();
await demo.run();
main.slint
import { AboutSlint, Button, VerticalBox } from "std-widgets.slint";
export component Demo {
in-out property <string> greeting <=> label.text;
VerticalBox {
alignment: start;
label := Text {
text: "Hello World!";
font-size: 24px;
horizontal-alignment: center;
}
AboutSlint {
preferred-height: 150px;
}
HorizontalLayout { alignment: center; Button { text: "OK!"; } }
}
}
deno run --allow-read --allow-ffi --allow-sys a.ts
I didn't find a way to compile with deno or node, is there an example?
@omarcosr: If I understood #1991 correctly, then you should be able to just use binaries now. The issue includes a little deno example that reportedly does just that.
We do not plan to implement a pure deno port in the near future. But it is already possible to use Slint with deno through the npm module. How to use the npm module also from deno is documented.
I close this now, but if we plan to do a deno port in the future the issue can be reopened.
With the new
napi
based node Slint port it is now possible to use Slint with deno e.g. by using the slint-ui npm package.Example
A complex example of using Slint with Deno can be found at https://codeberg.org/flovansl/co_sl/src/branch/main/apps/coop_local/deno.
The Slint support for Deno can be improved further following these steps:
originally description Expose the Slint API for Deno.
( originates from https://github.com/slint-ui/slint/discussions/1969 )