diff --git a/.ocamlformat b/.ocamlformat index c870de9..e80baea 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1 +1 @@ -version=0.26.1 +version=0.27.0 diff --git a/dune-project b/dune-project index 1a86c4b..48d12cf 100644 --- a/dune-project +++ b/dune-project @@ -26,6 +26,6 @@ (description "An Eio counterpart to package js_of_ocaml-lwt.") (depends (eio_js_backend (= :version)) - (js_of_ocaml-ppx (>= "5.0.1")) - (js_of_ocaml (>= 5.0.1)))) + (js_of_ocaml-ppx (>= "6.0.0")) + (js_of_ocaml (>= 6.0.0)))) (using mdx 0.2) diff --git a/js_of_ocaml-eio.opam b/js_of_ocaml-eio.opam index 219fd96..621c896 100644 --- a/js_of_ocaml-eio.opam +++ b/js_of_ocaml-eio.opam @@ -11,8 +11,8 @@ bug-reports: "https://github.com/ocaml-multicore/eio_js/issues" depends: [ "dune" {>= "3.9"} "eio_js_backend" {= version} - "js_of_ocaml-ppx" {>= "5.0.1"} - "js_of_ocaml" {>= "5.0.1"} + "js_of_ocaml-ppx" {>= "6.0.0"} + "js_of_ocaml" {>= "6.0.0"} "odoc" {with-doc} ] build: [ diff --git a/lib_eio_js_backend/eio_js_backend.ml b/lib_eio_js_backend/eio_js_backend.ml index 32f0b76..358bbcb 100644 --- a/lib_eio_js_backend/eio_js_backend.ml +++ b/lib_eio_js_backend/eio_js_backend.ml @@ -133,8 +133,11 @@ let start main = !uncaught_exception_handler ex bt; Scheduler.next ()); effc = - (fun (type a) (e : a Effect.t) : - ((a, suspend) Effect.Deep.continuation -> suspend) option -> + (fun (type a) + (e : a Effect.t) + : + ((a, suspend) Effect.Deep.continuation -> suspend) option + -> match e with | Eio.Private.Effects.Suspend f -> Some diff --git a/lib_js_of_ocaml_eio/examples/boulderdash/boulderdash.ml b/lib_js_of_ocaml_eio/examples/boulderdash/boulderdash.ml index 1eadc1c..065b95b 100644 --- a/lib_js_of_ocaml_eio/examples/boulderdash/boulderdash.ml +++ b/lib_js_of_ocaml_eio/examples/boulderdash/boulderdash.ml @@ -421,11 +421,11 @@ let start _ = let t0 = Sys.time () in let rec fade () = let t = Sys.time () in - if t -. t0 >= 1. then table##.style##.opacity := Js.def (js "1") + if t -. t0 >= 1. then table##.style##.opacity := js "1" else ( Eio_js.sleep 0.05; table##.style##.opacity - := Js.def (js (Printf.sprintf "%g" (t -. t0))); + := js (Printf.sprintf "%g" (t -. t0)); fade ()) in fade (); diff --git a/lib_js_of_ocaml_eio/js_events.ml b/lib_js_of_ocaml_eio/js_events.ml index 7f3e112..c5cd4b2 100644 --- a/lib_js_of_ocaml_eio/js_events.ml +++ b/lib_js_of_ocaml_eio/js_events.ml @@ -50,7 +50,7 @@ let make_event event_kind ?use_capture ?passive target = type cancel = { cancel : unit -> unit } let with_error_log f x = - try f x with e -> Firebug.console##log (Js.string (Printexc.to_string e)) + try f x with e -> Console.console##log (Js.string (Printexc.to_string e)) let seq_loop ~sw evh ?(cancel_handler = false) ?use_capture ?passive target handler = @@ -327,11 +327,11 @@ let mousewheel ?use_capture ?passive target = ?capture:(opt_map Js.bool use_capture) ?passive:(opt_map Js.bool passive) target (fun (ev : #Dom_html.event Js.t) ~dx ~dy -> - Firebug.console##log ev; + Console.console##log ev; cancel (); resolve (ev, (dx, dy)); Js.bool true) - (* true because we do not want to prevent default -> + (* true because we do not want to prevent default -> the user can use the preventDefault function above. *)); cancel) @@ -605,7 +605,7 @@ let request_animation_frame () = Eio_js_backend.await ~setup:(fun ~resolve ~reject:_ -> Dom_html.window##requestAnimationFrame - (Js.wrap_callback (fun (_ : float) -> resolve ()))) + (Js.wrap_callback (fun _ -> resolve ()))) ~cancel:(fun id -> Dom_html.window##cancelAnimationFrame id) let onload () = make_event Dom_html.Event.load Dom_html.window diff --git a/lib_js_of_ocaml_eio/xmlHttpRequest.ml b/lib_js_of_ocaml_eio/xmlHttpRequest.ml index 79cca21..57aa074 100644 --- a/lib_js_of_ocaml_eio/xmlHttpRequest.ml +++ b/lib_js_of_ocaml_eio/xmlHttpRequest.ml @@ -222,9 +222,7 @@ let perform_raw ?(headers = []) ?content_type ?(get_args = []) (* IE doesn't have the same semantics for HEADERS_RECEIVED. so we wait til LOADING to check headers. See: http://msdn.microsoft.com/en-us/library/ms534361(v=vs.85).aspx *) - | HEADERS_RECEIVED when not Dom_html.onIE -> - ignore (do_check_headers ()) - | LOADING when Dom_html.onIE -> ignore (do_check_headers ()) + | HEADERS_RECEIVED -> ignore (do_check_headers ()) | DONE -> (* If we didn't catch a previous event, we check the header. *) if do_check_headers () then @@ -247,14 +245,13 @@ let perform_raw ?(headers = []) ?content_type ?(get_args = []) progress e##.loaded e##.total; Js._true) | None -> ()); - Optdef.iter req##.upload (fun upload -> - match upload_progress with - | Some upload_progress -> - upload##.onprogress := - Dom.handler (fun e -> - upload_progress e##.loaded e##.total; - Js._true) - | None -> ()); + (match upload_progress with + | Some upload_progress -> + req##.upload##.onprogress + := Dom.handler (fun e -> + upload_progress e##.loaded e##.total; + Js._true) + | None -> ()); (match contents with | None -> req##send Js.null | Some (`Form_contents (`Fields l)) ->