static/README.wasm.md                     |    8 ++++----
 static/source/embindmaker/embindmaker.cxx |    3 +--
 unotest/source/embindtest/embindtest.js   |    5 ++---
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 621322b6ac0bebab2f904b7fe8d040193a1f45ba
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Tue Feb 27 21:59:37 2024 +0100
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Wed Feb 28 07:53:41 2024 +0100

    Generate slightly more flexible JS init_unoembind_* functions
    
    ...that return the "hierarchical object", rather than setting it as a 
member of
    the passed-in instance
    
    Change-Id: I17ad7dd426114c7979f1ba6edaebe83b43eedfed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164064
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/static/README.wasm.md b/static/README.wasm.md
index e37242508b72..f2abc8219ce8 100644
--- a/static/README.wasm.md
+++ b/static/README.wasm.md
@@ -223,8 +223,8 @@ improvement! ;)
 Some usage examples through javascript of the current implementation:
 ```js
 // inserts a string at the start of the Writer document.
-init_unoembind_uno(Module);
-let css = Module.unoembind_uno.com.sun.star;
+let uno = init_unoembind_uno(Module);
+let css = uno.com.sun.star;
 xModel = Module.getCurrentModelFromViewSh();
 xTextDocument = new css.text.XTextDocument(xModel.$query());
 xText = xTextDocument.getText();
@@ -238,8 +238,8 @@ xModel.delete(); xTextDocument.delete(); xText.delete(); 
xSimpleText.delete(); x
 
 ```js
 // changes each paragraph of the Writer document to a random color.
-init_unoembind_uno(Module);
-let css = Module.unoembind_uno.com.sun.star;
+let uno = init_unoembind_uno(Module);
+let css = uno.com.sun.star;
 xModel = Module.getCurrentModelFromViewSh();
 xEnumAccess = new css.container.XEnumerationAccess(xText.$query());
 xParaEnumeration = xEnumAccess.createEnumeration();
diff --git a/static/source/embindmaker/embindmaker.cxx 
b/static/source/embindmaker/embindmaker.cxx
index 335b7983503c..37175d100cdf 100644
--- a/static/source/embindmaker/embindmaker.cxx
+++ b/static/source/embindmaker/embindmaker.cxx
@@ -955,8 +955,7 @@ SAL_IMPLEMENT_MAIN()
         }
         jsOut << "function init_unoembind_" << name
               << "(instance) {
"
-                 "    instance.unoembind_"
-              << name << " = {
";
+                 "    return {
";
         writeJsMap(jsOut, *module, "        ");
         jsOut << "    };
"
                  "};
";
diff --git a/unotest/source/embindtest/embindtest.js 
b/unotest/source/embindtest/embindtest.js
index 3d3196cc4c39..146be3fa545a 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -9,9 +9,8 @@
 
 Module.addOnPostRun(function() {
     console.log('Running embindtest');
-    init_unoembind_uno(Module);
-    let test = new Module.unoembind_uno.org.libreoffice.embindtest.Test(
-        Module.getUnoComponentContext());
+    let uno = init_unoembind_uno(Module);
+    let test = new 
uno.org.libreoffice.embindtest.Test(Module.getUnoComponentContext());
     console.assert(typeof test === 'object');
     {
         let v = test.getBoolean();

Reply via email to