summaryrefslogtreecommitdiffstats
path: root/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs')
-rw-r--r--toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs19
1 files changed, 19 insertions, 0 deletions
diff --git a/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs
new file mode 100644
index 0000000000..c062d64e0c
--- /dev/null
+++ b/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/CallbackInterfaceHandler.sys.mjs
@@ -0,0 +1,19 @@
+const {{ cbi.handler() }} = new UniFFICallbackHandler(
+ "{{ callback_ids.name(ci, cbi) }}",
+ {{ callback_ids.get(ci, cbi) }},
+ [
+ {%- for method in cbi.methods() %}
+ new UniFFICallbackMethodHandler(
+ "{{ method.nm() }}",
+ [
+ {%- for arg in method.arguments() %}
+ {{ arg.ffi_converter() }},
+ {%- endfor %}
+ ],
+ ),
+ {%- endfor %}
+ ]
+);
+
+// Allow the shutdown-related functionality to be tested in the unit tests
+UnitTestObjs.{{ cbi.handler() }} = {{ cbi.handler() }};