-
Notifications
You must be signed in to change notification settings - Fork 189
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
How to tackle a JavaScript function that returns a JS Promise
?
#1073
Comments
Js_of_ocaml doesn't have official support for the promise API. You'll need to use a library like https://github.com/mnxn/promise_jsoo |
Thank you. Does Promise support seem likely via #944 ? |
Update: I opted for
fail to include Dune works, however. Am I missing anything in the above commands? |
you need to pass the path to if i were you, id stick to using Dune though |
Your suggestion worked!
compiled bg.js with its dependencies. dune, even with release profile, produces a js file of 2.2MB. The above command generated an output of 40KB. That’s a drastic difference. Unless there is a way to drastically cut down the output size of dune, I see much value in the latter solution. |
I think that's because Dune includes the "--sourcemap-inline" command in it's invocation of js_of_ocaml. I don't know how you turn that off, but you can check to see what the difference would be by deleting the last line (it should be a comment) in the .js file |
Sorry I got time to inspect further today. Anyway, quoting myself from ocaml/dune#4030 (comment):
|
The size issue has been resolved by mnxn/promise_jsoo@174d490 The answer to this issue is to use promise_jsoo. I'll create an issue to document this fact and close this issue. |
From what I understand, while
lwt
provides a counterpart to JSPromise
, it doesn't have a mechanism to mix those two (like translating js Promise into lwt).The text was updated successfully, but these errors were encountered: