For interfacing with JS (or the host environment in general) it is best to have some minimal C wrapper, e.g. put this into
value myFunction(value arg1);
and then declare on the OCaml side as usual, e.g.
external myFunction : int -> int = "myFunction".
You can link
mylib.o into the final executable, e.g.
wasicaml ... -cclib mylib.o.
If you want to call OCaml from JS, you’d have to register callbacks.
Hope this helps (I can make a bigger and more complete example if needed).