Source

xJs / lib / google.ml

Full commit
open Js
open Base

class type t = object
  method load : string_t (* name *) -> string_t (* version *) -> 'option Js.t (* option *) -> unit meth
  method setOnLoadCallback : (unit -> unit) (* ? *) -> unit meth

end

let get_google : unit -> t Js.t = fun () -> Unsafe.variable "google"
(** The variable "google" may not exist when API loading is delayed *)

let load_ajax_api : string_t -> string_t -> 'option Js.t -> unit = 
  fun name version option -> (get_google()) ## load (name, version, option)

let setOnLoadCallback f = (get_google()) ## setOnLoadCallback (f)