-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] WebRTC bindings #757
Comments
There's some existing discussion about promises here: #609. TL;DR: JavaScript Promises are not type-safe and therefore binding directly to the Promise API would be unsound. |
ResizeObserver is now included as part of #867 |
In order to test stuff related to WebCrypto, I did a very quick wrapper around promises. It doesn't care about failures and it's not practical. But it's short and quick to copy-paste if you find yourself wanting to test something else before diving into promises support in jsoo. The code is below, comes with no guarantee and is remotely usable in practice only if you're doing some kind of FRP.
|
I'll document binding availability in #1217 |
Hi!
I've recently done some work on implementing bindings for some browser API not present in js_of_ocaml standard library.
WebRTC API
The bindings are not complete and final, but I think they are sufficient for most users.
The implementation can be found here.
Promise API
During the implementation of WebRTC bindings, I've found that this API heavily uses promises, but there is no support for promises in js_of_ocaml stdlib. Moreover, some existing js_of_ocaml bindings, e.g. for the
mediaElement
object, do not meet the modern browsers' API, which requires a promise to be returned for theplay
method.I've found the ocaml-promise-js project developed by @johnelse with Promise API bindings implemented. Unfortunately, it is not in the OPAM repository. I've slightly modified it by adding
to_lwt
andto_lwt_result
functions, as I think that working with Lwt is far more convenient from the OCaml side. Maybeof_lwt
andof_lwt_result
functions may also be of interest. Here is the code.ResizeObserver API
js_of_ocaml already has bindings for MutationObeserver API, but lacks bindings for ResizeObserver. Here is the code.
Is there any interest in merging this to
js_of_ocaml
repo? If yes, I can provide a PR.Of course I will accept any advises on how the code can be improved and refactored to meet jsoo conventions.
The text was updated successfully, but these errors were encountered: