Add a convenience pop() function (we already have push...) and re-use the model
instead of fetching it.
Previously we fetched it because it was converted to
a new array every time.
A Model<T> stores a reference to a External<Rc<ModelNotify>>.
Every time such a Model<T> needs to be exposed to Slint/Rust, we create
a TypedRustModel that wraps the Rc<ModelNotify>, a strong reference to
the JS object, and the Type field for the expected data type (the
interpreter expects). The Model trait is implemented on TypedRustModel,
which means it is allocated every time the conversion is needed, but the
underlying Rc<ModelNotify> is shared and thus the (forwarded) ModelNotify.
When converting back to JavaScript, we downcast_ref to the
TypedRustModel and fetch the original JavaScript object - if available.
Tests under tests/cases/for_each_style are run with all styles at least
in the Rust driver.
Amends 6bb9905191 to include a test that
using edited works.
The trick is that the backend selector build by default with the
i-slint-backend-qt, but the "enable" feature is only enabled if the
qt-backend feature is enabled explicitly, or on linux from the slint
or slint-interpreter crate
If the generated code contains "\"" and format!("{}", ..), the latter would be
corrupted because the code formatter rewrites "{}" as if it were a code block.
- We could import from `npm:...` directly, but by using an import map, the import is centrally controlled and all subsequent snippets for Node.js can also be used with Deno
- Use .mjs for the node snippet as we use ES module syntax
Unfortunately our own examples can't be equipped with a deno.json yet as
deno does not support yet imports of node modules from a local path.
They are not commonly used so no need to use semi-public api for that
and it's really easy to similate with ust two clicks anyway
The previous test function were added before there was public way to
send events
This was requested by a customer recently and it seems rather straight-forward to implement and offer. `clear()` mirrors `std::vector::clear()` and `set_vector` mirrors the `set_vec` we have in Rust.
These are built with the default features of the interpreter crate, as
unfortunately napi-rs doesn't allow us to select features on the command
line yet. The next version (3.0) will add that, then we can keep the
binaries in sync.
So meanwhile, these are basically winit/femtovg/software enabled
binaries.
cc #1991