From 864384ab713e87c9f140de4981271a861d72210c Mon Sep 17 00:00:00 2001 From: Zzull Date: Wed, 13 Jan 2021 18:57:31 +0100 Subject: [PATCH] Os_tips: Change the type of 'onclose' --- CHANGES | 3 +++ opam | 2 +- src/os_tips.eliom | 11 ++++++----- src/os_tips.eliomi | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 3574d7423..b514de958 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +===== 4.0.0 (2021-01-13) ===== +* BREAKING CHANGE Os_tips: change the type of 'onclose' + ===== 2.13.0 (2019-12-20) ===== * Os_tips: add unset_tip_seen diff --git a/opam b/opam index 96fe74d88..2aeb82d7f 100644 --- a/opam +++ b/opam @@ -1,6 +1,6 @@ opam-version: "2.0" name: "ocsigen-start" -version: "3.0.0" +version: "4.0.0" authors: "dev@ocsigen.org" maintainer: "dev@ocsigen.org" synopsis: "An Eliom application skeleton ready to use to build your own application with users, (pre)registration, notifications, etc" diff --git a/src/os_tips.eliom b/src/os_tips.eliom index 6eace880d..88bb67b35 100644 --- a/src/os_tips.eliom +++ b/src/os_tips.eliom @@ -151,7 +151,8 @@ let%client reset_tips () = (* Returns a block containing a tip, if it has not already been seen by the user. *) let%shared block ?(a = []) ?(recipient = `All) - ?(onclose = [%client (fun () -> () : unit -> unit)]) ~name ~content () = + ?(onclose = [%client (fun () -> Lwt.return_unit : unit -> unit Lwt.t)]) + ~name ~content () = let myid_o = Os_current_user.Opt.get_current_userid () in match recipient, myid_o with | `All, _ @@ -164,7 +165,7 @@ let%shared block ?(a = []) ?(recipient = `All) let box_ref = ref None in let close : (unit -> unit Lwt.t) Eliom_client_value.t = [%client (fun () -> - ~%onclose (); + let%lwt () = ~%onclose () in let () = match !(~%box_ref) with | Some x -> Manip.removeSelf x | None -> () in @@ -204,7 +205,7 @@ let%client () = Eliom_client.onchangepage onchangepage_handler (* Display a tip bubble *) let%client display_bubble ?(a = []) ?arrow ?top ?left ?right ?bottom ?height ?width - ?(parent_node : _ elt option) ?(delay = 0.0) ?(onclose = fun () -> ()) + ?(parent_node : _ elt option) ?(delay = 0.0) ?(onclose = fun () -> Lwt.return_unit) ~name ~content () = let current_waiter = !waiter in @@ -214,7 +215,7 @@ let%client display_bubble ?(a = []) let bec = D.div ~a:[a_class ["os-tip-bec"]] [] in let box_ref = ref None in let close = fun () -> - onclose (); + let%lwt () = onclose () in let () = match !box_ref with | Some x -> Manip.removeSelf x | None -> () in @@ -315,7 +316,7 @@ let%shared bubble Eliom_client_value.t) () = let delay : float option = delay in - let onclose : (unit -> unit) Eliom_client_value.t option = onclose in + let onclose : (unit -> unit Lwt.t) Eliom_client_value.t option = onclose in let myid_o = Os_current_user.Opt.get_current_userid () in match recipient, myid_o with | `All, _ diff --git a/src/os_tips.eliomi b/src/os_tips.eliomi index 980930aef..77a52cc82 100644 --- a/src/os_tips.eliomi +++ b/src/os_tips.eliomi @@ -57,7 +57,7 @@ val bubble : ?width:int Eliom_client_value.t -> ?parent_node:[< `Body | Html_types.body_content ] Eliom_content.Html.elt -> ?delay:float -> - ?onclose:(unit -> unit) Eliom_client_value.t -> + ?onclose:(unit -> unit Lwt.t) Eliom_client_value.t -> name:string -> content:((unit -> unit Lwt.t) -> Html_types.div_content Eliom_content.Html.elt list Lwt.t) @@ -72,7 +72,7 @@ val bubble : val block : ?a:[< Html_types.div_attrib > `Class ] Eliom_content.Html.D.attrib list -> ?recipient:[> `All | `Connected | `Not_connected ] -> - ?onclose:(unit -> unit) Eliom_client_value.t -> + ?onclose:(unit -> unit Lwt.t) Eliom_client_value.t -> name:string -> content:((unit -> unit Lwt.t) Eliom_client_value.t -> Html_types.div_content Eliom_content.Html.elt list Lwt.t) ->