js-of-ocaml

    4热度

    1回答

    安装npm和node,编译OCaml的文件与js_of_ocaml了错误后,因此我做了opam switch reinstall system: :testweb $ opam switch reinstall system Your system compiler has been changed. Do you want to upgrade your OPAM installation ?

    5热度

    3回答

    我对OCaml和js_of_ocaml编译器都很陌生。 有人设法编译使用js_of_ocaml使用Jane Street Core的应用程序吗?在编译期间,我收到了很多“缺少原语”的警告,然后当我尝试运行它时,它们变成了一个实际的例外。 我知道那些原始码不能从OCaml移植到JS,并且它们的实现应该取决于应用程序,但是对于核心,其实现数以千计,而我的程序只使用输出到stdout。 在附注中,即使编

    0热度

    1回答

    我已经定义了OCaml函数manipulate: string -> string。我把它包起来做一个JS功能jsManipulate: let() = Js.Unsafe.global##.jsManipulate := Js.wrap_callback (fun s -> Js.string (manipulate (Js.to_string s))) 现在,我想不光

    0热度

    1回答

    我现在正在尝试Eliom,看看我能用它做些什么。 我想从我的eliom客户端代码中调用外部JavaScript库。 我想要的代码示例如下: [%%client let three_lib = Js.Unsafe.js_expr "THREE" in let scene2 = Js.Unsafe.new_obj three_lib##.Scene [||] in l

    0热度

    1回答

    我在使用jooc包装d3-force的子集时遇到了问题。该库不使用对象属性,而是实现融合的getter-setter函数,例如, simulation.force("x", d3.forceX()) // setter simulation.force("x") // getter 我想找到一种方法来模拟OCaml中的同一种多态性。这是我目前有 module Force = struc

    0热度

    1回答

    的属性: let td = Dom_html.createTd doc in 我现在想给对象的属性。我曾经尝试这样做: td#setAttribute (Js.string "colspan") (Js.string "4") 但我得到的错误: 错误:此表达式的类型为Dom_html.tableCellElement Js.t 它没有方法的setAttribute

    2热度

    1回答

    我正在试验js_of_ocaml和node.js.如您所知,node.js大量使用回调来实现异步请求,而不引入显式线程。 在OCaml中,我们有一个非常好的线程库Lwt,它带有非常有用的语法扩展。我编写了一个绑定到某个节点库(AWS S3客户端)的原型,并添加了一个lwt-ish图层来隐藏回调。 open Lwt.Infix open Printf open Js let require_

    0热度

    1回答

    在下面的代码中,我尝试处理复选框上的单击事件。我期望在javascript控制台中看到打印出的单词“hello”,但是我什么都看不到。我如何修改代码以获取print语句执行? let checkGroupByRounds = Dom_html.createInput ~_type:(Js.string "checkbox") doc in Lwt_js_events.clicks che

    1热度

    1回答

    我正在使用Eliom构建一个新项目,并且无法使用OUnit为单元测试设置编译过程。 我有两个文件: Js_Client_Code.eliom - contains all of the client side code Project.eliom - contains all of the server side code (including opening Js_Client_Code.el

    0热度

    1回答

    我有一个行js_of_ocaml程序: Dom_html.window##scroll 100 100 ; 哪个失败,出现错误: File "tests/test_scrolling.ml", line 2, characters 0-23: Error: This expression has type int -> int -> unit Js.meth but an exp