Skip to content
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

state of js compilation #56

Closed
joprice opened this issue Nov 18, 2018 · 3 comments
Closed

state of js compilation #56

joprice opened this issue Nov 18, 2018 · 3 comments

Comments

@joprice
Copy link
Contributor

joprice commented Nov 18, 2018

The only notes I see concerning web support are an unchecked box for supporting it as a platform, so I'm assuming this is a known issue, but I'm curious what the state of it is. In the build, I see the script 'build:js'. I ran it, then started an http server in _build/default/examples and opened index.html. I got the following error:

Uncaught TypeError: runtime.caml_glfwDefaultWindowHints is not a function

I checked _build/default/examples/Bin.bc.js, and it seems to be defined.

I'm personally interested in using js_of_ocaml for full stack dev, so very curious about the root cause here and steps to debug and solve.

@bryphe
Copy link
Member

bryphe commented Nov 19, 2018

I'm personally interested in using js_of_ocaml for full stack dev, so very curious about the root cause here and steps to debug and solve.

Cool, I'm in the same boat 👍

The core library we use for all of our OpenGL / rendering stuff actually works to be built via js_of_ocaml as well - and runnable in the browser: https://github.com/bryphe/reason-glfw

There is a gap today to get Revery working completely in the browser - the library we use for parsing / rendering font characters only works on native today: revery-ui/reason-fontkit#3 - we'll definitely need to fix that.

But it looks like there is a bug there - I think it's a bug with reason-glfw - specifically, the way we define that stub: https://github.com/bryphe/reason-glfw/blob/master/src/glfw_stubs.js

@bryphe
Copy link
Member

bryphe commented Nov 22, 2018

Worked through a few issues here:

  • bryphe/reason-glfw#48 - Fix caml_glfwDefaultWindowHints
  • bryphe/reason-glfw#49 - Implement JSOO strategy for glfwSetKeyCallback
  • bryphe/reason-glfw#52 - fix bug with image loading in WebGL

Now we're hitting errors like:

Uncaught TypeError: runtime.caml_fk_new_face is not a function

This is expected since reason-fontkit doesn't support JSOO yet - have https://github.com/bryphe/reason-fontkit#10 tracking. It'd be great to just have a stub implementation there for now!

@bryphe
Copy link
Member

bryphe commented Jan 4, 2019

With the work @jchavarri did to bring reason-fontkit over, and the fixes in reason-glfw, I believe the JSOO strategy is completely unblocked now (aside from some bugs). Closing this, but feel free to open new issues tracking particular bugs.

@bryphe bryphe closed this as completed Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants