talex5 / cuekeeper

Browser-based GTD (TODO list) system. No server needed.
http://roscidus.com/blog/blog/2015/04/28/cuekeeper-gitting-things-done-in-the-browser/
GNU Lesser General Public License v2.1
289 stars 23 forks source link

An error occurred while executing make client, because the function of _requestAnimationFrame is deprecated. #34

Open coldlapy opened 1 week ago

coldlapy commented 1 week ago

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!

talex5 commented 4 days ago

Looking at https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame it seems that:

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).