Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
internal.ml1 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129[@@@js.dummy "!! This code has been generated by gen_js_api !!"] [@@@ocaml.warning "-7-32-39"] module Promise(T:Promise_intf.P) = struct type +'a t = 'a T.t let t_to_js to_js (p : 'a t) : Ojs.t= let js = T.t_to_js Obj.magic p in Ojs.call js "then" [|(((fun (x1 : 'a -> Ojs.t) -> Ojs.fun_to_js 1 (fun (x2 : Ojs.t) -> x1 (Obj.magic x2)))) to_js)|] let t_of_js of_js (js : Ojs.t) : 'a t= let js = Ojs.call js "then" [|(((fun (x3 : Ojs.t -> 'a) -> Ojs.fun_to_js 1 (fun (x4 : Ojs.t) -> Obj.magic (x3 x4)))) of_js)|] in T.t_of_js Obj.magic js let new_ : (('a -> unit) -> (Ojs.t -> unit) -> unit) -> 'a t = fun (x5 : ('a -> unit) -> (Ojs.t -> unit) -> unit) -> t_of_js Obj.magic (Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Promise") [|(Ojs.fun_to_js 2 (fun (x6 : Ojs.t) (x8 : Ojs.t) -> x5 (fun (x7 : 'a) -> ignore (Ojs.apply x6 [|(Obj.magic x7)|])) (fun (x9 : Ojs.t) -> ignore (Ojs.apply x8 [|x9|]))))|]) let resolve : 'a -> 'a t = fun (x11 : 'a) -> t_of_js Obj.magic (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "resolve" [|(Obj.magic x11)|]) let reject : Ojs.t -> 'a t = fun (x13 : Ojs.t) -> t_of_js Obj.magic (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "reject" [|x13|]) let catch : 'a t -> (Ojs.t -> 'a t) -> 'a t = fun (x18 : 'a t) (x15 : Ojs.t -> 'a t) -> t_of_js Obj.magic (Ojs.call (t_to_js Obj.magic x18) "catch" [|(Ojs.fun_to_js 1 (fun (x16 : Ojs.t) -> t_to_js Obj.magic (x15 x16)))|]) let then_ : 'a t -> fulfilled:('a -> 'b t) -> ?rejected:(Ojs.t -> 'b t) -> unit -> 'b t = fun (x29 : 'a t) ~fulfilled:(x21 : 'a -> 'b t) ?rejected:(x22 : (Ojs.t -> 'b t) option) () -> t_of_js Obj.magic (let x31 = t_to_js Obj.magic x29 in Ojs.call (Ojs.get_prop_ascii x31 "then") "apply" [|x31;((let x23 = Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Array") [||] in ignore (Ojs.call x23 "push" [|(Ojs.fun_to_js 1 (fun (x27 : Ojs.t) -> t_to_js Obj.magic (x21 (Obj.magic x27))))|]); (match x22 with | Some x24 -> ignore (Ojs.call x23 "push" [|(Ojs.fun_to_js 1 (fun (x25 : Ojs.t) -> t_to_js Obj.magic (x24 x25)))|]) | None -> ()); x23))|]) let finally : 'a t -> (unit -> unit) -> 'a t = fun (x34 : 'a t) (x33 : unit -> unit) -> t_of_js Obj.magic (Ojs.call (t_to_js Obj.magic x34) "finally" [|(Ojs.fun_to_js 1 (fun _ -> x33 ()))|]) let all : 'a t array -> 'a array t = fun (x37 : 'a t array) -> t_of_js (fun (x40 : Ojs.t) -> Ojs.array_of_js Obj.magic x40) (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "all" [|(Ojs.array_to_js (fun (x38 : 'a t) -> t_to_js Obj.magic x38) x37)|]) let all2 : ('a t * 'b t) -> ('a * 'b) t = fun (x42 : ('a t * 'b t)) -> t_of_js (fun (x48 : Ojs.t) -> let x49 = x48 in ((Obj.magic (Ojs.array_get x49 0)), (Obj.magic (Ojs.array_get x49 1)))) (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "all" [|((let (x43, x44) = x42 in let x45 = Ojs.array_make 2 in Ojs.array_set x45 0 (t_to_js Obj.magic x43); Ojs.array_set x45 1 (t_to_js Obj.magic x44); x45))|]) let all3 : ('a t * 'b t * 'c t) -> ('a * 'b * 'c) t = fun (x50 : ('a t * 'b t * 'c t)) -> t_of_js (fun (x58 : Ojs.t) -> let x59 = x58 in ((Obj.magic (Ojs.array_get x59 0)), (Obj.magic (Ojs.array_get x59 1)), (Obj.magic (Ojs.array_get x59 2)))) (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "all" [|((let (x51, x52, x53) = x50 in let x54 = Ojs.array_make 3 in Ojs.array_set x54 0 (t_to_js Obj.magic x51); Ojs.array_set x54 1 (t_to_js Obj.magic x52); Ojs.array_set x54 2 (t_to_js Obj.magic x53); x54))|]) let race : 'a t array -> 'a t = fun (x60 : 'a t array) -> t_of_js Obj.magic (Ojs.call (Ojs.get_prop_ascii Ojs.global "Promise") "race" [|(Ojs.array_to_js (fun (x61 : 'a t) -> t_to_js Obj.magic x61) x60)|]) end module IndirectPromise = struct let wrap : 'a -> 'a = fun (x64 : 'a) -> Obj.magic (Ojs.call (Ojs.get_prop_ascii Ojs.global "IndirectPromise") "wrap" [|(Obj.magic x64)|]) let unwrap : 'a -> 'a = fun (x65 : 'a) -> Obj.magic (Ojs.call (Ojs.get_prop_ascii Ojs.global "IndirectPromise") "unwrap" [|(Obj.magic x65)|]) end