3535*)
3636
3737open % client Js_of_ocaml
38+
3839[%% client open Js_of_ocaml_lwt ]
3940[%% shared open Eliom_content.Html ]
4041[%% shared open Eliom_content.Html.F ]
42+ [%% shared open Lwt.Syntax ]
4143
4244let % client clX = Ot_swipe. clX
4345let % client clY = Ot_swipe. clY
@@ -181,7 +183,7 @@ let%shared make ?(a = []) ?(vertical = false) ?(position = 0)
181183 max 1 (truncate (float (width_carousel + 1 ) /. float width_element))
182184 in
183185 Lwt. async (fun () ->
184- let % lwt () = Ot_nodeready. nodeready d2' in
186+ let * () = Ot_nodeready. nodeready d2' in
185187 ~% set_nb_visible_elements (comp_nb_visible_elements () );
186188 Lwt. return_unit);
187189 let maxi () = ~% maxi - React.S. value ~% nb_visible_elements + 1 in
@@ -294,10 +296,10 @@ let%shared make ?(a = []) ?(vertical = false) ?(position = 0)
294296 React.Step. execute step;
295297 set_active () ;
296298 Lwt. async (fun () ->
297- let % lwt () =
299+ let * () =
298300 if move
299301 then
300- let % lwt _ = Lwt_js_events. transitionend d2' in
302+ let * _ = Lwt_js_events. transitionend d2' in
301303 Lwt. return_unit
302304 else Lwt. return_unit
303305 in
@@ -318,7 +320,7 @@ let%shared make ?(a = []) ?(vertical = false) ?(position = 0)
318320 (fun _ -> ~% set_nb_visible_elements (comp_nb_visible_elements () ))
319321 (if vertical then Ot_size. height else Ot_size. width));
320322 Lwt. async (fun () ->
321- let % lwt () = Ot_nodeready. nodeready d2' in
323+ let * () = Ot_nodeready. nodeready d2' in
322324 set_position ~% position; add_transition d2'; Lwt. return_unit);
323325 let perform_animation a =
324326 ~% set_nb_visible_elements (comp_nb_visible_elements () );
@@ -335,7 +337,7 @@ let%shared make ?(a = []) ?(vertical = false) ?(position = 0)
335337 if not ! animation_frame_requested
336338 then (
337339 animation_frame_requested := true ;
338- let % lwt () = Lwt_js_events. request_animation_frame () in
340+ let * () = Lwt_js_events. request_animation_frame () in
339341 animation_frame_requested := false ;
340342 (match ! action with
341343 | `Move (delta , width_element ) ->
@@ -569,25 +571,26 @@ let%client set_default_fail f =
569571 :> exn -> Html_types. div_content Eliom_content.Html. elt)
570572
571573let % shared generate_content generator =
572- try % lwt Eliom_shared.Value. local generator ()
573- with e -> Lwt. return (default_fail e)
574+ Lwt. catch
575+ (fun () -> Eliom_shared.Value. local generator () )
576+ (fun e -> Lwt. return (default_fail e))
574577
575578(* on the client side we generate the contents of the initially visible page
576579 asynchronously so the tabs will be rendered right away *)
577580let % client generate_initial_contents ~spinner sleeper gen =
578581 let s = spinner () in
579582 ( Lwt. async @@ fun () ->
580- let % lwt contents = generate_content gen in
583+ let * contents = generate_content gen in
581584 (* wait until DOM elements are created before attempting to replace them *)
582- let % lwt parent = sleeper in
585+ let * parent = sleeper in
583586 ignore @@ To_dom. of_element parent;
584587 Manip. replaceSelf s contents;
585588 Lwt. return () );
586589 Lwt. return (s, ref @@ None )
587590
588591(* on the server side we generate all the visible contents right away *)
589592let % server generate_initial_contents ~spinner: _ _ gen =
590- let % lwt contents = generate_content gen in
593+ let * contents = generate_content gen in
591594 Lwt. return (contents, ref @@ None )
592595
593596let % shared make_lazy ?a ?vertical ?(position = 0 ) ?transition_duration ?inertia
@@ -609,7 +612,7 @@ let%shared make_lazy ?a ?vertical ?(position = 0) ?transition_duration ?inertia
609612 let s = spinner () in
610613 s, ref @@ Some (s, gen)
611614 in
612- let % lwt contents, spinners_and_generators =
615+ let * contents, spinners_and_generators =
613616 Lwt. map List. split
614617 @@ Lwt_list. map_s (fun x -> x)
615618 @@ List. mapi mk_contents gen_contents
@@ -639,7 +642,7 @@ let%shared make_lazy ?a ?vertical ?(position = 0) ?transition_duration ?inertia
639642 match ! spinner_and_generator with
640643 | Some (spinner , gen_content ) ->
641644 spinner_and_generator := None ;
642- let % lwt content = generate_content gen_content in
645+ let * content = generate_content gen_content in
643646 Manip. replaceSelf spinner content;
644647 Lwt. return_unit
645648 | None -> Lwt. return () )
@@ -728,7 +731,7 @@ let%shared ribbon ?(a = [])
728731 in
729732 let curleft, set_curleft = React.S. create initial_gap in
730733 Lwt. async (fun () ->
731- let % lwt () = Ot_nodeready. nodeready container' in
734+ let * () = Ot_nodeready. nodeready container' in
732735 (* Ribbon position: *)
733736 set_containerwidth container'##.offsetWidth;
734737 Ot_noderesize. noderesize (Ot_noderesize. attach container') (fun () ->
@@ -749,7 +752,7 @@ let%shared ribbon ?(a = [])
749752 that runs on window resizing. So we make sure the ribbon code runs
750753 AFTER it has been placed into the fixed container by Ot_sticky. *)
751754 Lwt. async @@ fun () ->
752- let % lwt _ = Lwt_js. sleep 0.05 in
755+ let * _ = Lwt_js. sleep 0.05 in
753756 set_containerwidth container'##.offsetWidth;
754757 Lwt. return_unit);
755758 (* Changing the position of the ribbon when the carousel position
@@ -880,8 +883,8 @@ let%shared ribbon ?(a = [])
880883 | _ -> () );
881884 Lwt. return_unit);
882885 Lwt. async (fun () ->
883- let % lwt () = Ot_nodeready. nodeready container' in
884- let % lwt () = Lwt_js_events. request_animation_frame () in
886+ let * () = Ot_nodeready. nodeready container' in
887+ let * () = Lwt_js_events. request_animation_frame () in
885888 add_transition the_ul';
886889 Eliom_lib.Option. iter add_transition cursor_elt';
887890 Lwt. return_unit);
0 commit comments