# \#gen\_js\_api

**URL:** https://discuss.ocaml.org/tag/gen-js-api/345.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Binding a JavaScript method with a narrow return type](https://discuss.ocaml.org/t/binding-a-javascript-method-with-a-narrow-return-type/10456)

<div class="topic-metadata">

**Author:** [@bhoot](https://discuss.ocaml.org/u/bhoot)\
**Replies:** 1\
**Last updated:** [September 14, 2022, 4:40am UTC](https://discuss.ocaml.org/t/binding-a-javascript-method-with-a-narrow-return-type/10456 "2022-09-14T04:40:04Z")

</div>

I am writing bindings for Firefox WebExtension API using gen\_js\_api. One of the APIs browser.storage.local.get() returns an object literal with no definite shape: StorageArea.get() - Mozilla | MDN So far, I have come u…

---

## [Parameterized types with gen\_js\_api](https://discuss.ocaml.org/t/parameterized-types-with-gen-js-api/5623)

<div class="topic-metadata">

**Author:** [@borisd](https://discuss.ocaml.org/u/borisd)\
**Replies:** 0\
**Last updated:** [April 26, 2020, 6:49pm UTC](https://discuss.ocaml.org/t/parameterized-types-with-gen-js-api/5623 "2020-04-26T18:49:26Z")

</div>

Trying to create a binding for runtime.onMessage: The following code is not accepted by gen\_js\_api: “Error: Cannot parse class declaration” class \['message, 'response\] listener : Ojs.t -\> object inherit …

---

## [Gen\_js\_api: How to bind Js\_of\_ocaml.Js.t types](https://discuss.ocaml.org/t/gen-js-api-how-to-bind-js-of-ocaml-js-t-types/4909)

<div class="topic-metadata">

**Author:** [@borisd](https://discuss.ocaml.org/u/borisd)\
**Replies:** 2\
**Last updated:** [December 26, 2019, 2:01pm UTC](https://discuss.ocaml.org/t/gen-js-api-how-to-bind-js-of-ocaml-js-t-types/4909 "2019-12-26T14:01:06Z")

</div>

I want to bind a JS function that takes a Js\_of\_ocaml.Dom\_html.document Js\_of\_ocaml.Js.t. Js.t is not “JS-able” since it does not have Js\_of\_ocaml.Js.t\_to\_js and t\_of\_js. Since gen\_js\_api uses the js\_of\_ocaml runtime, is…
