Home

Awesome

Binding in OCaml to Javascript standard library

Build Status

This library aims to provide a binding to the JavaScript standard library and DOM using pure OCaml type (not using JS module from js_of_ocaml for example).

Some technologies such as js_of_ocaml provides a compiler from OCaml to JavaScript allowing OCaml developer to use OCaml to develop such as applications running in a browser or mobile applications using cordova.

How is this library implemented?

Gen_js_api is recommended which aims to provide binding to JavaScript independently of the OCaml to JavaScript compiler. With gen_js_api, you only need to provide the interface (mli file) and gen_js_api executable outputs the implementation.

How to install and compile your project?

Don't forget to switch to a compiler >= 4.03.0.

opam switch 4.03.0

You can use opam by pinning the repository with

opam pin add ocaml-js-stdlib https://github.com/dannywillems/ocaml-js-stdlib.git

and to compile (in bytecode) your project, use (add js_of_ocaml package if you use it)

ocamlfind ocamlc -o [output_bytecode_file] -package gen_js_api -package ocaml-js-stdlib [...] -linkpkg [other arguments]

You can also manually compile. A Makefile is provided:

How to use it

Gen_js_api and some files need the compiler >= 4.03.0. See the gen_js_api repository for informations about compilation.

Documentation

To-do

License

This library is under LGPL license.

Maintainers

Contributors