From 48591dc0d75eeb354b0f7332bb5ae80ed2628dbf Mon Sep 17 00:00:00 2001 From: jzaki Date: Tue, 21 Apr 2026 10:46:34 +0100 Subject: [PATCH] fix callback function params --- logos-developer-guide.md | 2 +- tutorial-cpp-ui-app.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logos-developer-guide.md b/logos-developer-guide.md index 225ba0f..d1a976a 100644 --- a/logos-developer-guide.md +++ b/logos-developer-guide.md @@ -815,7 +815,7 @@ readonly property var backend: logos.module("calc_ui_cpp") // Properties auto-sync: Text { text: backend.status } // Return values via Promise: -logos.watch(backend.add(1, 2)).then(function(v) { ... }) +logos.watch(backend.add(1, 2), function(v) { ... }) ``` - Scaffold: `nix flake init -t github:logos-co/logos-module-builder#ui-qml-backend` diff --git a/tutorial-cpp-ui-app.md b/tutorial-cpp-ui-app.md index ff47bc9..774dffa 100644 --- a/tutorial-cpp-ui-app.md +++ b/tutorial-cpp-ui-app.md @@ -304,7 +304,7 @@ Item { root.errorText = "" root.result = "..." // logos.watch() wraps the pending reply in a JS Promise - logos.watch(backend[method].apply(backend, args)).then( + logos.watch(backend[method].apply(backend, args), function(value) { root.result = String(value) }, function(error) { root.errorText = String(error) } ) @@ -370,7 +370,7 @@ Key patterns: - `logos.module("calc_ui_cpp")` — gets the typed replica (auto-synced properties) - `backend.status` — PROP from `.rep`, updates automatically -- `logos.watch(backend.add(1, 2)).then(...)` — SLOT return value as JS Promise +- `logos.watch(backend.add(1, 2), ...)` — SLOT return value as JS Promise - ``— required for`logos.watch()` --- @@ -507,7 +507,7 @@ node tests/ui-tests.mjs # in another terminal | Pattern | .rep declaration | Backend C++ | QML usage | | ---------------- | ------------------------------------ | ------------------------------------------- | ---------------------------------------------------------------------- | -| **Return value** | `SLOT(int add(int a, int b))` | `int add(...) override { return ...; }` | `logos.watch(backend.add(1,2)).then(cb)` | +| **Return value** | `SLOT(int add(int a, int b))` | `int add(...) override { return ...; }` | `logos.watch(backend.add(1,2), cb)` | | **Property** | `PROP(QString status READWRITE)` | `setStatus("Ready")` (inherited) | `backend.status` (auto-syncs) | | **Signal** | `SIGNAL(errorOccurred(QString msg))` | `emit errorOccurred("fail")` | `Connections { target: backend; function onErrorOccurred(msg) {...} }` | | **Model** | (use Q_PROPERTY on backend) | `Q_PROPERTY(QAbstractItemModel* items ...)` | `logos.model("calc_ui_cpp", "items")` |