Commits

camlspotter committed 31e3bfb

cleanup

  • Participants
  • Parent commits cfbb28c

Comments (0)

Files changed (10)

 
 NATIVE_ENABLED = false
 
-OCAMLFLAGS   = -annot -w A-4-32
-
 OCAMLDEPFLAGS= -syntax camlp4o -package lwt,js_of_ocaml.syntax
 OCAMLPPFLAGS= -syntax camlp4o -package lwt,js_of_ocaml.syntax
 
 open Js
 
-let google = Unsafe.variable "google"
-
 module OnLoad = struct
   (*
     <script type="text/javascript">
 
 FILES[] =
     std
+    base
     xUnsafe
     unsafe
-    xLwt
     http
     google
 
+open Js
+
+type int_t = int t
+type float_t = float t
+type string_t = js_string t
+type 'a array_t = 'a js_array t
+
+let (~^) = Js.string
+
+class type any = object
+end
+
+let any (a : 'a t) : any t = Obj.magic a
+
+external int : int -> int t = "%identity"
+
+let alert s = ignore (Js.Unsafe.fun_call (Js.Unsafe.variable "alert") [| Js.Unsafe.inject (Js.string s) |])
+let alertf fmt  = Printf.ksprintf alert fmt
+
+open Js
+
+(** Some shorter names of JS objects *)
+
+type int_t = int t
+type float_t = float t
+type string_t = js_string t
+type 'a array_t = 'a js_array t
+
+val (~^) : string -> string_t
+
+class type any = object end
+
+val any : 'a t -> any t
+
+external int : int -> int t = "%identity"
+
+val alert : string -> unit
+  (** JS alert function *)
+
+val alertf : ('a, unit, string, unit) format4 -> 'a
+  (** JS alert function, printf style *)
-open Js
+include Base
 
-type int_t = int t
-type float_t = float t
-type string_t = js_string t
-type 'a array_t = 'a js_array t
-
-class type any = object
+module Lwt = struct
+  include Lwt
+  include Lwt_js
 end
-
-let any (a : 'a t) : any t = Obj.magic a
-
-external int : int -> int t = "%identity"
-
-let alert s = ignore (Js.Unsafe.fun_call (Js.Unsafe.variable "alert") [| Js.Unsafe.inject (Js.string s) |])
-
-module Lwt = XLwt

lib/std.mli

-open Js
-
-(** Some shorter names of JS objects *)
-
-type int_t = int t
-type float_t = float t
-type string_t = js_string t
-type 'a array_t = 'a js_array t
-
-class type any = object end
-
-val any : 'a t -> any t
-
-external int : int -> int t = "%identity"
-
-val alert : string -> unit
-  (** JS alert function *)

lib/xLwt.ml

-module Lwt = struct
-  include Lwt
-  include Lwt_js
-end
-
-include Lwt
-let literal = Js.Unsafe.variable (* Actually this does not work, if I put the definition here. *)
-
 (* A workaround... *)    
 let literal s = Js.Unsafe.eval_string (Printf.sprintf "( %s )" s)
 open XJs
 open Std
 open Google
-open XLwt (* Some functions of Lwt is overridden by Lwt_js *)
+open Lwt
 
 let _ = google##load (Js.string "visualization", Js.string "1.0", Unsafe.literal "{'packages':['corechart']}")