-
Notifications
You must be signed in to change notification settings - Fork 9
/
tea_app.resi
76 lines (65 loc) · 1.83 KB
/
tea_app.resi
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
type program<'flags, 'model, 'msg> = {
init: 'flags => ('model, Tea_cmd.t<'msg>),
update: ('model, 'msg) => ('model, Tea_cmd.t<'msg>),
view: 'model => Vdom.t<'msg>,
subscriptions: 'model => Tea_sub.t<'msg>,
shutdown: 'model => Tea_cmd.t<'msg>,
}
type standardProgram<'flags, 'model, 'msg> = {
init: 'flags => ('model, Tea_cmd.t<'msg>),
update: ('model, 'msg) => ('model, Tea_cmd.t<'msg>),
view: 'model => Vdom.t<'msg>,
subscriptions: 'model => Tea_sub.t<'msg>,
}
type beginnerProgram<'model, 'msg> = {
model: 'model,
update: ('model, 'msg) => 'model,
view: 'model => Vdom.t<'msg>,
}
type pumpInterface<'model, 'msg> = {
startup: unit => unit,
renderString: 'model => string,
handleMsg: ('model, 'msg) => 'model,
shutdown: Tea_cmd.t<'msg> => unit,
}
type programInterface<'msg> = {
"getHtmlString": unit => string,
"pushMsg": 'msg => unit,
"shutdown": unit => unit,
}
@obj
external makeProgramInterface: (
~pushMsg: 'msg => unit,
~shutdown: unit => unit,
~getHtmlString: unit => string,
) => programInterface<'msg> = ""
let programStateWrapper: (
'msg,
ref<Vdom.applicationCallbacks<'msg>> => pumpInterface<'msg, 'msg>,
'msg => Tea_cmd.t<'msg>,
) => programInterface<'msg>
let programLoop: (
('msg, 'b) => ('msg, Tea_cmd.t<'b>),
'msg => Vdom.t<'b>,
'msg => Tea_sub.t<'b>,
'msg,
Tea_cmd.t<'b>,
option<Dom.node>,
ref<Tea_cmd.applicationCallbacks<'b>>,
) => pumpInterface<'msg, 'b>
let program: (
program<'flags, 'model, 'msg>,
Js.null_undefined<Dom.node>,
'flags,
) => programInterface<'msg>
let standardProgram: (
standardProgram<'flags, 'model, 'msg>,
Js.null_undefined<Dom.node>,
'flags,
) => programInterface<'msg>
let beginnerProgram: (
beginnerProgram<'model, 'msg>,
Js.null_undefined<Dom.node>,
unit,
) => programInterface<'msg>
let map: ('msg => 'b, Vdom.t<'msg>) => Vdom.t<'b>