Commits

camlspotter committed 9e3d16f

updated

  • Participants
  • Parent commits 0752aad

Comments (0)

Files changed (4)

 open Js
 
-type int_t = int t
-type float_t = float t
-type string_t = js_string t
+module U = Unsafe
+
+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
+let (!$) = Js.string
 
 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 alert s = ignore (U.fun_call (U.variable "alert") [| U.inject (string s) |])
 let alertf fmt  = Printf.ksprintf alert fmt
-
 
 (** Some shorter names of JS objects *)
 
-type int_t = int t
-type float_t = float t
-type string_t = js_string t
+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
+val (!$) : string -> string_t
 
 external int : int -> int t = "%identity"
 
+open Js
+open Js.Unsafe
+
 (* A workaround... *)    
-let literal s = Js.Unsafe.eval_string (Printf.sprintf "( %s )" s)
+let literal s = eval_string (Printf.sprintf "( %s )" s)
+
+(* window.initialize = drawMap 
+   or window["initialize"] = drawMap
+*)
+let set_variable name v = set Dom_html.window (string name) v
 
 val literal : string -> 'a t
 (** Creation of a JS object literal from a string *)
+
+val set_variable : string -> 'a -> unit