Description
All the examples in the examples
subfolder are exclusively in OCaml. None of the .html
files includes any JavaScript code at all. This is a unique subset of the expected applications of js_of_ocaml
; I would think that many applications will include some code in OCaml and some in JavaScript.
For instance, my situation is that I have a large and existing app in JavaScript, and I want to compile an existing OCaml library so that my app can use it. I would think that there would be many similar use cases, especially since JS is among the most popular of languages. But the examples folder seems to focus exclusively on the (possibly rare?) case in which the entire app will be written exclusively in OCaml.
Thus this issue requests extending the examples folder with examples that show how to access compiled OCaml from in-page JavaScript. I did find this article that gave me some brief tips on how to do it, but that page confesses that it's not very experienced, and may not be doing it the correct way. An official example would be good, and with some supporting documentation even better.
I checked the existing docs here but the JS-OCaml connections discussed there seem to be only in the other direction: If you have an existing JS library you need to access from OCaml, not the reverse.