libreofficekit/README.md |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit fd22acaf8914b11962d6667eacfc47e514fc7b43
Author:     Miklos Vajna <[email protected]>
AuthorDate: Wed May 29 08:21:37 2024 +0200
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu May 30 10:24:35 2024 +0200

    lok: document some guidelines on how to not end up with too many callbacks
    
    In general, the existing command dispatch, command value getter &
    command state callback is meant to be enough for most needs.
    
    (cherry picked from commit ff0cb77a6c9fec7127c26f63a420e877ac4f852e)
    
    Change-Id: Ibba5455b461a8eac052f17ac5e824ddea42755f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168240
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/libreofficekit/README.md b/libreofficekit/README.md
index 95a33707a28a..148879ec57fc 100644
--- a/libreofficekit/README.md
+++ b/libreofficekit/README.md
@@ -81,6 +81,20 @@ once a feature works there, then implement the Android part, 
with its slower
 development iteration (slow uploading to the device, the need to link all
 object files into a single `.so`, etc).
 
+### LOK API guidelines
+
+Introducing explicit new API under `include/LibreOfficeKit/` adds type safety 
but listing each &
+every micro-feature in those headers don't scale. Before extending those 
headers, consider using one
+of the following alternatives, which require no changes to these headers:
+
+- LOK client → core direction: use `postUnoCommand()` to dispatch an UNO 
command, optionally with
+  parameters.
+- core → LOK client direction:
+  - Use `getCommandValues()` when this is initiated by the LOK client.
+  - Use `LOK_CALLBACK_STATE_CHANGED` with a JSON payload when this is 
initiated by core.
+
+It's useful to stick to these if possible, only add new C++ API when these are 
not a good fit.
+
 * Debugging with gdb and `gtktiledviewer`
 
 To run `gtktiledviewer`:

Reply via email to