summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-27 21:59:37 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-28 07:53:41 +0100
commit621322b6ac0bebab2f904b7fe8d040193a1f45ba (patch)
treef92cfc60d1e0098990f0632731cc487169f91eaf /static
parentc7664f12a99b6e08eb334d63646c3d2a6aa75e18 (diff)
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.bergmann@allotropia.de>
Diffstat (limited to 'static')
-rw-r--r--static/README.wasm.md8
-rw-r--r--static/source/embindmaker/embindmaker.cxx3
2 files changed, 5 insertions, 6 deletions
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) {\n"
- " instance.unoembind_"
- << name << " = {\n";
+ " return {\n";
writeJsMap(jsOut, *module, " ");
jsOut << " };\n"
"};\n";