-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathjsoo_common.mli
59 lines (36 loc) · 1.42 KB
/
jsoo_common.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(**
This module is shared between different JSOO / Playground based modules
*)
module Js : sig
module Unsafe : sig
type any
external inject : 'a -> any = "%identity"
external get : 'a -> 'b -> 'c = "caml_js_get"
external set : 'a -> 'b -> 'c -> unit = "caml_js_set"
external pure_js_expr : string -> 'a = "caml_pure_js_expr"
val global : 'a
type obj
external obj : (string * any) array -> obj = "caml_js_object"
end
type (-'a, +'b) meth_callback
type 'a callback = (unit, 'a) meth_callback
external wrap_callback : ('a -> 'b) -> ('c, 'a -> 'b) meth_callback
= "caml_js_wrap_callback"
external wrap_meth_callback : ('a -> 'b) -> ('a, 'b) meth_callback
= "caml_js_wrap_meth_callback"
type +'a t
type js_string
external string : string -> js_string t = "caml_js_from_string"
external to_string : js_string t -> string = "caml_js_to_string"
external create_file : js_string t -> js_string t -> unit = "caml_create_file"
external to_bytestring : js_string t -> string = "caml_js_to_byte_string"
type number
external number_of_float : float -> number t = "caml_js_from_float"
external bool : bool -> bool t = "caml_js_from_bool"
type 'a js_array
external array : 'a array -> 'a js_array t = "caml_js_from_array"
end
(*
Creates a Js Error object for given location with and a certain error message
*)
val mk_js_error : Location.t -> string -> Js.Unsafe.obj