Source

xJs / lib / base.ml

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