Skip to content

Commit

Permalink
Merge pull request #616 from Zzull/master
Browse files Browse the repository at this point in the history
Os_tips: Change the type of 'onclose'
  • Loading branch information
Jan Rochel authored Jan 15, 2021
2 parents a688f43 + 864384a commit 7da2958
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "ocsigen-start"
version: "3.0.0"
version: "4.0.0"
authors: "[email protected]"
maintainer: "[email protected]"
synopsis: "An Eliom application skeleton ready to use to build your own application with users, (pre)registration, notifications, etc"
Expand Down
11 changes: 6 additions & 5 deletions src/os_tips.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -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, _
Expand 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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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, _
Expand Down
4 changes: 2 additions & 2 deletions src/os_tips.eliomi
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) ->
Expand Down

0 comments on commit 7da2958

Please sign in to comment.