From 7fe6bfccd4fd1aa777291e48319350a7e539dd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Fri, 20 Sep 2024 12:50:12 +0200 Subject: [PATCH] Fix use of deprecated APIs --- libs/amcharts3/amcharts3.ml | 2 +- libs/amcharts3/amcharts3_bis.ml | 2 +- libs/amcharts3/ammap3.ml | 2 +- libs/disqus/ezjs_disqus.ml | 4 ++-- libs/google_auth/ezjs_gauth.ml | 6 +++--- libs/utils/ezjs_tyxml.ml | 2 +- libs/utils/ezjs_tyxml.mli | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/amcharts3/amcharts3.ml b/libs/amcharts3/amcharts3.ml index efca795..50ae291 100644 --- a/libs/amcharts3/amcharts3.ml +++ b/libs/amcharts3/amcharts3.ml @@ -365,7 +365,7 @@ class type amCharts = let amCharts() = let amCharts : amCharts Js.t = - Js.Unsafe.variable "AmCharts" + Js.Unsafe.global ##. _AmCharts in amCharts diff --git a/libs/amcharts3/amcharts3_bis.ml b/libs/amcharts3/amcharts3_bis.ml index ecc4b89..878a404 100644 --- a/libs/amcharts3/amcharts3_bis.ml +++ b/libs/amcharts3/amcharts3_bis.ml @@ -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 () = diff --git a/libs/amcharts3/ammap3.ml b/libs/amcharts3/ammap3.ml index b29a909..2a08c00 100644 --- a/libs/amcharts3/ammap3.ml +++ b/libs/amcharts3/ammap3.ml @@ -122,7 +122,7 @@ class type amCharts = let amCharts() = let amCharts : amCharts Js.t = - Js.Unsafe.variable "AmCharts" + Js.Unsafe.global ##. _AmCharts in amCharts diff --git a/libs/disqus/ezjs_disqus.ml b/libs/disqus/ezjs_disqus.ml index e7b70dd..9f8a90c 100644 --- a/libs/disqus/ezjs_disqus.ml +++ b/libs/disqus/ezjs_disqus.ml @@ -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; @@ -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; diff --git a/libs/google_auth/ezjs_gauth.ml b/libs/google_auth/ezjs_gauth.ml index 422700d..ca103f4 100644 --- a/libs/google_auth/ezjs_gauth.ml +++ b/libs/google_auth/ezjs_gauth.ml @@ -212,13 +212,13 @@ 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 + let cb () = Optdef.case (Unsafe.global ##. gapi) none f in ignore @@ Dom_html.window##setTimeout (wrap_callback cb) timeout | Some gapi -> f gapi diff --git a/libs/utils/ezjs_tyxml.ml b/libs/utils/ezjs_tyxml.ml index b7f436d..9c6ebdb 100644 --- a/libs/utils/ezjs_tyxml.ml +++ b/libs/utils/ezjs_tyxml.ml @@ -34,7 +34,7 @@ type 'a elt = 'a Html.elt open Js -exception JsError = Error +exception JsError = Js_error.Exn type ('a, 'b) result = ('a, 'b) Stdlib.result = Ok of 'a | Error of 'b let doc = Dom_html.document diff --git a/libs/utils/ezjs_tyxml.mli b/libs/utils/ezjs_tyxml.mli index c0ee482..87a5746 100644 --- a/libs/utils/ezjs_tyxml.mli +++ b/libs/utils/ezjs_tyxml.mli @@ -34,7 +34,7 @@ type 'a elt = 'a Html.elt open Js -exception JsError of error t +exception JsError of Js_error.t type ('a, 'b) result = ('a, 'b) Stdlib.result = Ok of 'a | Error of 'b val alert: string -> unit