I have an array of objects in my Javascript file that I need to access from js_of_ocaml. I've come up with this so far:
let table_decks = (Js.Unsafe.variable "table_decks" :>
< deck_nr : int > Js.js_array Js.t)
In Javascript, the array will be like table_decks = {{deck_nr: 10, ...}, {deck_nr: 20, ...}}
with more fields than just deck_nr
.
My question is: How do I access this array? I find a lot of functions in Js.js_array
, but no get/set.
(Another question is if the coerce is in fact correct?)