rizo / jx

Work with JavaScript values in OCaml.

Home Page:https://rizo.github.io/jx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jx

Work with JavaScript values in OCaml.

Examples

(* Bind the global document value. *)
let document = Jx.global "document"

let get_element_by_id id =
  (* Define decoder for the return type. *)
  let return = Jx.Decoder.(nullable js) in
  (* Bind the method call: document.getElementById(id). *)
  Jx.Obj.call1 document "getElementById" Jx.Encoder.string id ~return

About

Work with JavaScript values in OCaml.

https://rizo.github.io/jx/

License:MIT License


Languages

Language:OCaml 97.8%Language:Makefile 1.2%Language:Nix 1.0%