Skip to content

Commit

Permalink
fix js_of_ocaml-ppx dependency and 4.12 16 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtori committed May 11, 2021
1 parent d412d08 commit e141dc6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
5 changes: 2 additions & 3 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(name ezjs_utils)
(synopsis "A collection of useful libraries to build sites with js_of_ocaml")
(depends
(js_of_ocaml (>= 3.4.0))
(js_of_ocaml-ppx (>= 3.4.0))
stdlib-shims)
(depopts
(lwt (>= 5.3.0))
Expand All @@ -35,13 +35,12 @@
(name ezjs_bs4)
(synopsis "Bootstrap4 helpers")
(depends
(js_of_ocaml-ppx (>= 3.4.0))
ezjs_utils ezjs_cleave ezjs_jquery))

(package
(name ezjs_disqus)
(synopsis "Binding for Disqus")
(depends (js_of_ocaml (>= 3.4.0))))
(depends (js_of_ocaml-ppx (>= 3.4.0))))

(package
(name ezjs_gauth)
Expand Down
1 change: 0 additions & 1 deletion ezjs_bs4.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ doc: "https://ocamlpro.github.io/ezjs/doc"
bug-reports: "https://github.com/ocamlpro/ezjs/issues"
depends: [
"dune" {>= "2.5"}
"js_of_ocaml-ppx" {>= "3.4.0"}
"ezjs_utils"
"ezjs_cleave"
"ezjs_jquery"
Expand Down
2 changes: 1 addition & 1 deletion ezjs_utils.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ doc: "https://ocamlpro.github.io/ezjs/doc"
bug-reports: "https://github.com/ocamlpro/ezjs/issues"
depends: [
"dune" {>= "2.5"}
"js_of_ocaml" {>= "3.4.0"}
"js_of_ocaml-ppx" {>= "3.4.0"}
"stdlib-shims"
]
depopts: [
Expand Down
7 changes: 0 additions & 7 deletions libs/utils/dune
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
(public_name ezjs_utils.xhr)
(modules ezjs_xhr)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
Expand All @@ -46,7 +45,6 @@
(public_name ezjs_utils.storage)
(modules ezjs_storage)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
Expand All @@ -62,15 +60,13 @@
(public_name ezjs_utils.cookie)
(modules ezjs_cookie)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
(name ezjs_session)
(public_name ezjs_utils.session)
(modules ezjs_session)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
Expand All @@ -87,15 +83,13 @@
(public_name ezjs_utils.onload)
(modules ezjs_onload)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
(name ezjs_date)
(public_name ezjs_utils.date)
(modules ezjs_date)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))

(library
Expand All @@ -112,5 +106,4 @@
(public_name ezjs_utils.canvas)
(modules ezjs_canvas)
(preprocess (pps js_of_ocaml-ppx))
(libraries js_of_ocaml)
(modes byte))
8 changes: 4 additions & 4 deletions libs/utils/ezjs_xhr_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let unoptf f def x = match Js.Opt.to_option x with
| None -> def
| Some x -> f x

let get ?(headers=[]) ~url ~args =
let get ?(headers=[]) ?(args=[]) url =
let (res, w) = Lwt.task () in
let req = XmlHttpRequest.create () in
let url = match args with
Expand Down Expand Up @@ -57,12 +57,12 @@ let get ?(headers=[]) ~url ~args =
Lwt.on_cancel res (fun () -> req##abort);
res

let post ?(headers=[]) ?(get_args=[]) ~url ~body =
let post ?(headers=[]) ?(args=[]) ~body url =
let (res, w) = Lwt.task () in
let req = XmlHttpRequest.create () in
let url = match get_args with
let url = match args with
| [] -> url
| _ -> url ^ "?" ^ (url_encode_list get_args) in
| _ -> url ^ "?" ^ (url_encode_list args) in
req##(_open (Js.string "POST") (Js.string url) (Js._true));
req##(setRequestHeader (Js.string "Content-type")
(Js.string "application/x-www-form-urlencoded"));
Expand Down
6 changes: 3 additions & 3 deletions libs/utils/ezjs_xhr_lwt.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ exception Request_failed of (int * string)

val post:
?headers:(string * string) list ->
?get_args:(string * string) list ->
url:string -> body:string option -> string Lwt.t
?args:(string * string) list ->
body:string option -> string -> string Lwt.t

val get:
?headers:(string * string) list ->
url:string -> args:(string * string) list -> string Lwt.t
?args:(string * string) list -> string -> string Lwt.t

0 comments on commit e141dc6

Please sign in to comment.