Add webview
diff --git a/units-impl-wasm.js b/units-impl-wasm.js
new file mode 100644
index 0000000..b8f6191
--- /dev/null
+++ b/units-impl-wasm.js
@@ -0,0 +1,18 @@
+const units = require("./units.js");
+
+units().then((Module) => {
+ let _do_a_conversion = Module.cwrap("do_a_conversion", "number", [
+ "number",
+ "number",
+ ]);
+
+ async function convert(from, to = "") {
+ let from_c = Module.stringToNewUTF8(from);
+ let to_c = Module.stringToNewUTF8(to);
+ let lenBefore = globalThis.printBuffer.length;
+ _do_a_conversion(from_c, to === "" ? 0 : to_c);
+ return globalThis.printBuffer.slice(lenBefore).trim();
+ }
+
+ window.convert = convert;
+});
\ No newline at end of file