@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface WireViewExperimental

    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.

    A property written here belongs to this track alone: set() or a bind() that produces it throws invalid ("property rows is 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 without seq gets 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 with limit), Markdown documents and images in wire form, and a stale refusal 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 before ready, a closed one) a write is refused with unavailable, 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 with false.

    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.

    const status = plugin.windows.create("ui/status.slint");
    await status.show();
    const direct = plugin.wire.view(status); // writes below bind() and set()
    const timer = setInterval(() => {
    void direct.write("line", { value: new Date().toLocaleTimeString() });
    }, 1000);
    plugin.onDispose(() => clearInterval(timer));

    1.7.0

    interface WireView {
        write(property: string, write: PropertyWrite): Promise<boolean>;
        writeRows(property: string, ops: readonly RowOp[]): Promise<boolean>;
    }
    Index
    • Experimental

      Write one property: a whole value, or a row patch of the plugin's own.

      Parameters

      • property: string

        The Slint property's name.

      • write: PropertyWrite

        The write, as the player takes it.

      Returns Promise<boolean>

      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.

      limit (rejects) The player refused a value over its limits.

      stale (rejects) A patch's base is not what the player shows.

      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));

      1.7.0

    • Experimental

      Change a list property by row operations, numbered by the SDK.

      Parameters

      • property: string

        The Slint property's name.

      • ops: readonly RowOp[]

        The operations, applied in order.

      Returns Promise<boolean>

      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.

      unsupported (rejects) The player takes no row patches.

      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.

      unavailable (rejects) The view does not show.

      0.6.0

      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" }] },
      ]);

      1.7.0