cuekeeper
cuekeeper copied to clipboard
An error occurred while executing make client, because the function of _requestAnimationFrame is deprecated.
An error occurred while executing make client
dune build ./js/client.bc.js @runtest
File "js/ck_animate.ml", line 40, characters 8-39:
Error (warning 3): deprecated: Js_of_ocaml.Dom_html._requestAnimationFrame
[since 2.6] Use [Dom_html.window##requestAnimationFrame] instead.
File "js/ck_animate.ml", line 74, characters 8-39:
Error (warning 3): deprecated: Js_of_ocaml.Dom_html._requestAnimationFrame
[since 2.6] Use [Dom_html.window##requestAnimationFrame] instead.
File "js/ck_animate.ml", line 97, characters 22-53:
Error (warning 3): deprecated: Js_of_ocaml.Dom_html._requestAnimationFrame
[since 2.6] Use [Dom_html.window##requestAnimationFrame] instead.
make: *** [Makefile:14: client-test] Error 1
I checked the Dom_html description of Js_of_ocaml,
Deprecated [since 2.6] Use [Dom_html.window##requestAnimationFrame] instead.
So I modified it like this
[Dom_html.window##requestAnimationFrame] (Js.wrap_callback aux)
But it still reports an error
File "js/ck_animate.ml", line 40, characters 9-47:
Error: This expression has type
(float -> unit) Js_of_ocaml__.Js.callback ->
Dom_html.animation_frame_request_id Js.meth
but an expression was expected of type 'a Js.meth
make: *** [Makefile:14: client-test] Error 1
Deprecated function.
val _requestAnimationFrame : (unit -> unit) [Js.callback]
It seems that there is a type mismatch. After learning some ocaml, I found that it is not so easy to modify, so I had to come here to ask for advice. thanks!
Looking at https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame it seems that:
auxnow gets a timestamp (float)requestAnimationFramenow returns an ID
You probably want something like let rec aux ts = ... and ignore (Dom_html.window##requestAnimationFrame (Js.wrap_callback aux) : Dom_html.animation_frame_request_id).
This is fixed.