summaryrefslogtreecommitdiffstats
path: root/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs')
-rw-r--r--toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs22
1 files changed, 22 insertions, 0 deletions
diff --git a/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs
new file mode 100644
index 0000000000..a38b6bdd94
--- /dev/null
+++ b/toolkit/components/uniffi-bindgen-gecko-js/src/templates/js/Boolean.sys.mjs
@@ -0,0 +1,22 @@
+// Export the FFIConverter object to make external types work.
+export class {{ ffi_converter }} extends FfiConverter {
+ static computeSize() {
+ return 1;
+ }
+ static lift(value) {
+ return value == 1;
+ }
+ static lower(value) {
+ if (value) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+ static write(dataStream, value) {
+ dataStream.writeUint8(this.lower(value))
+ }
+ static read(dataStream) {
+ return this.lift(dataStream.readUint8())
+ }
+}