Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.26.1
version=0.27.0
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions js_of_ocaml-eio.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
7 changes: 5 additions & 2 deletions lib_eio_js_backend/eio_js_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib_js_of_ocaml_eio/examples/boulderdash/boulderdash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
8 changes: 4 additions & 4 deletions lib_js_of_ocaml_eio/js_events.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
19 changes: 8 additions & 11 deletions lib_js_of_ocaml_eio/xmlHttpRequest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) ->
Expand Down