diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 14:57:35 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 16:22:43 +0100 |
commit | d24dd97a0335b2fbd28d1b9bfed9c8f5d0d1f7af (patch) | |
tree | 8c942312e8349a50cbdc2d74c37c75fa972cae6c /lib/elements/transfert.ml | |
parent | efd7e6c313b7a807af3d10b792d6f22dc1b6958c (diff) |
Update common library
Diffstat (limited to 'lib/elements/transfert.ml')
-rwxr-xr-x | lib/elements/transfert.ml | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/elements/transfert.ml b/lib/elements/transfert.ml index f324509..3001e32 100755 --- a/lib/elements/transfert.ml +++ b/lib/elements/transfert.ml @@ -1,5 +1,15 @@ open Brr +let send_raw + : filename:Jstr.t -> Jstr.t -> unit + = fun ~filename data -> + (* Create the link to download the the element, and simulate a click on it *) + let a = El.a + ~at:At.[ href Jv.Id.(of_jv @@ to_jv data) + ; v (Jstr.v "download") filename ] + [] in + El.click a + (** Send a file to the user. *) let send : mime_type:Jstr.t -> filename:Jstr.t -> Jstr.t -> unit @@ -16,9 +26,6 @@ let send ; base64data |] in - (* Create the link to download the the element, and simulate a click on it *) - let a = El.a - ~at:At.[ href Jv.Id.(of_jv @@ to_jv data) - ; v (Jstr.v "download") filename ] - [] in - El.click a + send_raw + ~filename + data |