ExperimentalExperimental
Write one property: a whole value, or a row patch of the plugin's own.
The Slint property's name.
The write, as the player takes it.
true once the player took it; false when a newer whole
value replaced it before it was sent.
Experimental: the wire protocol is not semver; this member changes with
versions. { value } replaces the property; a player that takes row
patches gets it with a seq (the SDK numbers it unless given) and a list
over one request's size in parts with more.
{ patch: { base, seq, ops } } is sent as given: base is the seq of
the write it applies on. WireView.writeRows numbers patches for
you.
invalid (throws) property is empty or set or bound already
on this view, or write has neither value nor patch.
unavailable (rejects) The view does not show, or it closed
or showed its initial properties again before the player answered.
A panel shows how many frames the plugin produced, pushed from the plugin's own loop. The write goes out at once; if the player is still busy with the previous one, only the newest count waits.
const panel = plugin.panels.mount("sidebar", "ui/counter.slint", { title: "Frames" });
await panel.ready;
const view = plugin.wire.view(panel);
let frames = 0;
const tick = setInterval(() => void view.write("frames", { value: ++frames }), 100); // newest waits
plugin.onDispose(() => clearInterval(tick));
Experimental
Change a list property by row operations, numbered by the SDK.
The Slint property's name.
The operations, applied in order.
true once the player applied them; false when a whole
value written later replaced them before they were sent.
Experimental: the wire protocol is not semver; this member changes with
versions. The operations apply, in order, on what the player shows for the
property after this view's last direct write of it since the view showed
its initial properties: set one row, insert rows, remove or move a
run of rows, by index. Without such a write (the property was never written
directly, or the window was shown again since) the player has no rows of
the plugin's for it: write the whole value with WireView.write
first. They go as one patch, or several applying on each other when they
exceed one request (1024 operations or 512 KB of rows). Needs a player that
takes row patches.
invalid (throws) property is empty or set or bound already
on this view, or ops is not an array.
stale (rejects) No whole value was written directly since
the view showed its initial properties (refused before sending), or
the player shows something else than the operations apply on: write
the whole value.
A list of 20,000 entries gains one at its end. Only the new row crosses
to the player, as one insert; the plugin wrote the whole list once
before with write.
await list.writeRows("entries", [
{ op: "insert", at: count, rows: [{ id: `e${count}`, label: "New entry" }] },
]);
A view's properties written directly (
plugin.wire.view(v)): whole values or row operations as the player takes them, sent as given. Experimental: the wire protocol is not semver; this member changes with versions.Remarks
A property written here belongs to this track alone:
set()or abind()that produces it throwsinvalid("propertyrowsis written directly; bind it or write it, not both"; a binding's is reported to Scope.onError once), and a property already set or bound cannot be written here. That keeps the SDK's record of what the player shows correct for the properties it compares.What the SDK does for these writes: one write in flight per property, in order (a whole value drops the writes still waiting before it, which resolve
false); with a player that takes row patches a whole value withoutseqgets one, a list larger than one request (512 KB of rows) goes in parts, and row operations are numbered and split the same way. What it leaves to the plugin: the value limits (the player refuses a value over them withlimit), Markdown documents and images in wire form, and astalerefusal of row operations (the player shows something else than they apply on: write the whole value). Property names are written in camelCase or as in Slint, as for View.set.While the view does not show (a window before
show(), a panel or settings page beforeready, a closed one) a write is refused withunavailable, and so is one the player answers after the view closed or showed its initial properties again. When a window shows its initial properties again (shown after a close), a property written here shows its Slint default: write its whole value again before any WireView.writeRows. Disposing the view resolves the writes still waiting withfalse.Example: Push a status line from a timer
A window shows a status line that the plugin's own timer refreshes once a second. Each write replaces the one still waiting, so a slow player never queues stale text; the window's bound values are not involved.
Since
1.7.0