问题标签 [js-of-ocaml]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ocaml - 等效于 document.getElementsByClassName
我找不到 js_of_ocaml 等效的document.getElementsByClassName
. 规范的做法是什么?
编辑:我正在使用 js_of_ocaml v2.5。
ocaml - js-of-ocaml 中的漂亮打印
我有以下 OCaml 程序打开 Js
和下面的 JavaScript 程序
运行编译的 ocaml 代码时,它会打印出来
有没有办法进行漂亮的打印以更好地显示格式?
canvas - js_of_ocaml 中带有水平滚动条的画布
我在 js_of_ocaml 中创建了一个画布,如下所示。
我只能看到一个白屏。
现在,我想在画布上添加一个水平滚动条。
我想我必须做一个比白色画布小的水平滚动条的盒子,白色画布在盒子里。
我怎样才能做到这一点?
ocaml - Compiling ocaml can't find module in opam library, Js.ml in js_from_ocaml
Trying to compile ocaml into javascript.
Some OCaml code I have put in https://gist.github.com/larsr/6b3cd6f62d54d56e3f9a uses the menhir
parser, and the js_of_ocaml
library together. I've installed them with opam
.
The code comes from http://toss.sourceforge.net/ocaml.html. It is a lexer and a parser and a main program that calls them. The goal is to generate a javascript program from the ocaml code and run it from within a web page.
I am able to compile the first Main program using only menhir
with make
from the Makefile in the repo, which does
and I can compile a program that only uses js_of_ocaml
, with make Formula.js
, which does
My problem is that now I'm unable to get ocamlfind
to build JsClient.js
, with
so I can't produce javascript code for 'JsClient.ml'. The error I get is that the compiler can't find the module Js
which is used by JsClient
. The code seems to be in the opam library in my home-dir, but I can't get the right arguments to ocamlfind
to use it.
How do I compile the JsClient.ml
into JsClient.js
?
ocaml - js_of_ocaml dom类型前面#字符的含义
以下签名中的“#”是什么意思?
node.js - 如何使用 js_of_ocaml 正确使用编译 OCaml 程序?
我想在 OCaml 中翻译以下 Javascript 示例程序,使用js_of_ocaml
:
我写了以下 OCaml 片段
但是当我编译它时
它与
如何修复我的程序或编译命令来解决这个问题?
node.js - What are the differences between Lwt.async and Lwt_main.run on OCaml/Node.JS?
I am experimenting with js_of_ocaml
and node.js. As you know, node.js makes extensive use of callbacks to implement asynchronous requests without introducing explicit threads.
In OCaml we have a very nice threading library, Lwt, coming with a very useful syntax extension. I wrote a prototype with a binding to some node library (a AWS S3 client) and added a lwt-ish layer to hide the callback.
#xA;Since there is no binding to Lwt_main
for node.js, I had to run my code with Lwt.async
. What are the differences between running the code with Lwt.async
rather than with Lwt_main.run
– the latter not existing in node.js? Is it guaranteed that the program will wait until the asynchronous threads are completed before exiting, or is this rather a lucky but random behaviour of my code?
ocaml - 在 js_of_ocaml 的 Dom_svg 中插入 Tyxml_js.Svg 值
假设我使用 Tyxml 的语法创建了一个 SVG 矩形:
如何使用 js_of_ocaml 的 API 将其插入 DOM 中?
我想做这样的事情:
但我不知道如何进行正确的类型转换。
ocaml - 绑定库:返回无类型对象 - 方法定义
我试图绑定的库的一部分返回一个对象 -
我不知道如何指定类类型,因为返回的对象是匿名的:
有人可以在这里提出前进的方向吗?
谢谢
缺口
js-of-ocaml - Tyxml - 将 svg 元素添加到 dom 树
刚刚开始用 Tyxml 打破僵局——似乎没有比这更进一步的了——
createCircle 参数需要一个“Dom_svg.document Js.t”,但给定一个“Dom_html.canvasElement Js.t”
有人可以给我一些关于如何将 svg 元素插入 dom 树的想法吗?
谢谢尼克