Skip to content

Commit

Permalink
Merge pull request #95 from ocaml-wasm/wasm
Browse files Browse the repository at this point in the history
Add explicit float conversions
  • Loading branch information
maxtori authored Sep 20, 2024
2 parents 5e9ce77 + be6e3c9 commit 4fa7bb0
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 65 deletions.
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(depopts
(lwt (>= 5.3.0))
(base64 (>= 3.2.0))
(js_of_ocaml-tyxml (>= 3.4.0))))
(js_of_ocaml-tyxml (>= 5.5.0))))

(package
(name ezjs_amcharts3)
Expand All @@ -40,7 +40,7 @@
(package
(name ezjs_disqus)
(synopsis "Binding for Disqus")
(depends (js_of_ocaml-ppx (>= 3.4.0))))
(depends (js_of_ocaml-ppx (>= 5.5.0))))

(package
(name ezjs_gauth)
Expand Down
2 changes: 1 addition & 1 deletion ezjs_disqus.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" {>= "5.5.0"}
]
build: [
["dune" "subst"] {pinned}
Expand Down
2 changes: 1 addition & 1 deletion ezjs_utils.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ depends: [
depopts: [
"lwt" {>= "5.3.0"}
"base64" {>= "3.2.0"}
"js_of_ocaml-tyxml" {>= "3.4.0"}
"js_of_ocaml-tyxml" {>= "5.5.0"}
]
build: [
["dune" "subst"] {pinned}
Expand Down
2 changes: 1 addition & 1 deletion libs/amcharts3/amcharts3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class type amCharts =

let amCharts() =
let amCharts : amCharts Js.t =
Js.Unsafe.variable "AmCharts"
Js.Unsafe.global ##. _AmCharts
in
amCharts

Expand Down
6 changes: 3 additions & 3 deletions libs/amcharts3/amcharts3_bis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ class type ['a] chart = object
method usePrefixes : bool_field
method addLabel :
int -> int -> Js.js_string Js.t -> Js.js_string Js.t -> int -> Js.js_string Js.t
-> int -> float -> bool -> Js.js_string Js.t -> unit Js.meth
-> int -> Js.number_t -> bool -> Js.js_string Js.t -> unit Js.meth
method addLegend : legend Js.t -> Js.js_string Js.t -> unit Js.meth
(* method addListerner *)
method addTitle : Js.js_string Js.t -> int -> Js.js_string Js.t -> float ->
method addTitle : Js.js_string Js.t -> int -> Js.js_string Js.t -> Js.number_t ->
bool -> unit Js.meth
method clear : unit Js.meth
method clearLabels : unit Js.meth
Expand Down Expand Up @@ -594,7 +594,7 @@ class type amCharts =
end

let amCharts () =
let amCharts : amCharts Js.t = Js.Unsafe.variable "AmCharts" in
let amCharts : amCharts Js.t = Js.Unsafe.global ##. _AmCharts in
amCharts

let export ?divId () =
Expand Down
2 changes: 1 addition & 1 deletion libs/amcharts3/ammap3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class type amCharts =

let amCharts() =
let amCharts : amCharts Js.t =
Js.Unsafe.variable "AmCharts"
Js.Unsafe.global ##. _AmCharts
in
amCharts

Expand Down
4 changes: 2 additions & 2 deletions libs/disqus/ezjs_disqus.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let build_config ?(lang="en") ?title url identifier () =
let title = match title with
| None -> Printf.sprintf "Thread for %s" identifier
| Some title -> title in
let disqus : disqus Js.t = Js.Unsafe.variable "DISQUS" in
let disqus : disqus Js.t = Js.Unsafe.global ##. _DISQUS in
let page_config : page Js.t = Js.Unsafe.obj [||] in
page_config##.identifier := Js.string identifier;
page_config##.url := Js.string url;
Expand All @@ -42,7 +42,7 @@ let init ?lang ?title url identifier name =
Dom.appendChild doc##.body s

let reset ?lang ?title url identifier =
let disqus : disqus Js.t = Js.Unsafe.variable "DISQUS" in
let disqus : disqus Js.t = Js.Unsafe.global ##. _DISQUS in
let disqus_obj : disqus_reset Js.t = Js.Unsafe.obj [||] in
disqus_obj##.reload := Js._true;
disqus_obj##.config := build_config ?lang ?title url identifier;
Expand Down
8 changes: 4 additions & 4 deletions libs/google_auth/ezjs_gauth.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ type auth_response = {
let verbose = ref false
let set_verbose v = verbose := v

let gapi : gapi t optdef = Unsafe.variable "gapi"
let gapi : gapi t optdef = Unsafe.global ##. gapi

let ready ?(none=fun () -> if !verbose then log_str "cannot find gapi")
?(timeout=500.) (f : gapi t -> unit) =
match Optdef.to_option (Unsafe.variable "gapi") with
match Optdef.to_option (Unsafe.global ##. gapi) with
| None ->
let cb () = Optdef.case (Unsafe.variable "gapi") none f in
ignore @@ Dom_html.window##setTimeout (wrap_callback cb) timeout
let cb () = Optdef.case (Unsafe.global ##. gapi) none f in
ignore @@ Dom_html.window##setTimeout (wrap_callback cb) (Js_of_ocaml.Js.float timeout)
| Some gapi -> f gapi

let init ?timeout params f =
Expand Down
2 changes: 1 addition & 1 deletion libs/utils/ezjs_bind.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open Js_of_ocaml

type string_field = Js.js_string Js.t Js.prop
type int_field = int Js.prop
type float_field = float Js.prop
type float_field = Js.number_t Js.prop
type bool_field = bool Js.prop
type 'a array_field = 'a Js.js_array Js.t Js.prop

Expand Down
Loading

0 comments on commit 4fa7bb0

Please sign in to comment.