package gen_js_api

  1. Overview
  2. Docs
Easy OCaml bindings for JavaScript libraries

Install

Dune Dependency

Authors

Maintainers

Sources

v1.1.0.tar.gz
md5=263dbe269b1b23fa58d146d7874acec6
sha512=e12a6e864afb6cac6229b56906a121f35a97d280e7008abe796b7583be934575c2c58b7944c720fd4bfb0ae6def04a1ffd37c8c71026e72862eb237324b69fe6

Description

gen_js_api aims at simplifying the creation of OCaml bindings for JavaScript libraries. Authors of bindings write OCaml signatures for JavaScript libraries and the tool generates the actual binding code with a combination of implicit conventions and explicit annotations.

gen_js_api is to be used with the js_of_ocaml compiler.

Published: 11 Feb 2022

README

gen_js_api: easy OCaml bindings for JavaScript libraries

Build Status"

Overview

gen_js_api aims at simplifying the creation of OCaml bindings for JavaScript libraries. It must currently be used with the js_of_ocaml compiler, although other ways to run OCaml code "against" JavaScript might be supported later with the same binding definitions (for instance, Bucklescript, or direct embedding of a JS engine in a native OCaml application).

gen_js_api is based on the following ideas:

  • Authors of bindings write OCaml signatures for JavaScript libraries and the tool generates the actual binding code with a combination of implicit conventions and explicit annotations.
  • The generated binding code takes care of translating values between OCaml and JavaScript and of dealing with JavaScript calling conventions.
  • All syntactic processing is done by authors of bindings: the client code is normal OCaml code and does not depend on custom syntax nor on JS-specific types.

gen_js_api can be used in two complementary ways:

Examples

The repository contains some examples of OCaml bindings to JavaScript libraries created with gen_js_api:

Documentation

  • js_of_ocaml: The compiler and runtime system on which gen_js_api relies. (Note: gen_js_api doesn't depend on js_of_ocaml's OCaml library, nor on its language extension.)
  • goji: A DSL to describe OCaml bindings for JavaScript libraries.
  • DefinitelyMaybeTyped: A project to parse DefinitelyTyped interfaces and produce OCaml interfaces.
  • ReScript: Another compiler from OCaml to JavaScript, featuring the genType ppx for generating TS / Flow types and runtime converters.

About

gen_js_api has been created by LexiFi for porting a web application from JavaScript to OCaml. The tool has been used in production since 2015.

This gen_js_api package is licensed by LexiFi under the terms of the MIT license.

See see Changelog

Contact: alain.frisch@lexifi.com

Contributors:

  • Alain Frisch
  • Sebastien Briais

Dependencies (6)

  1. ojs = "1.1.0"
  2. ppxlib >= "0.36"
  3. ocaml < "5.3"
  4. ppxlib >= "0.22" & < "0.36"
  5. ocaml >= "4.08"
  6. dune >= "2.7"

Dev Dependencies (4)

  1. odoc with-doc
  2. conf-npm with-test
  3. js_of_ocaml-compiler with-test
  4. ppxlib with-test & < "0.26.0"

Used by (50)

  1. bonsai >= "v0.15.0"
  2. cordova
  3. cordova-plugin-activity-indicator
  4. cordova-plugin-background-mode
  5. cordova-plugin-barcode-scanner
  6. cordova-plugin-battery-status
  7. cordova-plugin-camera
  8. cordova-plugin-clipboard
  9. cordova-plugin-datepicker
  10. cordova-plugin-device
  11. cordova-plugin-device-motion
  12. cordova-plugin-device-orientation
  13. cordova-plugin-dialogs
  14. cordova-plugin-email-composer
  15. cordova-plugin-fcm
  16. cordova-plugin-file
  17. cordova-plugin-file-opener
  18. cordova-plugin-file-transfer
  19. cordova-plugin-geolocation
  20. cordova-plugin-globalization
  21. cordova-plugin-image-picker
  22. cordova-plugin-inappbrowser
  23. cordova-plugin-insomnia
  24. cordova-plugin-keyboard
  25. cordova-plugin-loading-spinner
  26. cordova-plugin-local-notifications
  27. cordova-plugin-media
  28. cordova-plugin-media-capture
  29. cordova-plugin-network-information
  30. cordova-plugin-progress
  31. cordova-plugin-push-notifications
  32. cordova-plugin-qrscanner
  33. cordova-plugin-screen-orientation
  34. cordova-plugin-sim-card
  35. cordova-plugin-sms
  36. cordova-plugin-social-sharing
  37. cordova-plugin-statusbar
  38. cordova-plugin-toast
  39. cordova-plugin-touch-id
  40. cordova-plugin-vibration
  41. cordova-plugin-videoplayer
  42. jsonoo
  43. jsoo-react
  44. ocaml-js-stdlib
  45. ocaml-vdom < "transition"
  46. promise_jsoo
  47. promise_jsoo_lwt
  48. vdom
  49. virtual_dom >= "v0.15.0"
  50. virtual_dom_toplayer

Conflicts (1)

  1. js_of_ocaml-compiler < "4.0.0"
OCaml

Innovation. Community. Security.