@@ -5,14 +5,108 @@ wip: true
55---
66
77``` reason
8+ type appKey = string;
9+ type section = string;
10+ type taskId = float;
11+ type taskKey = string;
12+
13+ type task('data) = 'data => Js.Promise.t(unit);
14+ type taskProvider('data) = unit => task('data);
15+ type taskCanceller = unit => unit;
16+ type taskCancelProvider = unit => taskCanceller;
17+
18+ type componentProvider('a) = unit => React.component('a);
19+ type wrapperComponentProvider('a, 'b) = 'b => React.component('a);
20+
21+ type appParameters;
22+
23+ external asAppParameters: 'a => appParameters = "%identity";
24+
25+ type appConfig;
26+
27+ [@bs.obj]
28+ external appConfig:
29+ (
30+ ~appKey: string,
31+ ~component: componentProvider('a)=?,
32+ ~run: appParameters => unit=?,
33+ ~section: bool=?,
34+ unit
35+ ) =>
36+ appConfig =
37+ "";
38+
39+ type runnable('a) = {
40+ .
41+ "component": Js.Nullable.t(componentProvider('a)),
42+ "run": appParameters => unit,
43+ };
44+
45+ type registry('a) = {
46+ .
47+ "sections": array(section),
48+ "runnables": Js.Dict.t(runnable('a)),
49+ };
50+
51+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
52+ external getAppKeys: unit => array(appKey) = "";
53+
54+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
55+ external getRegistry: unit => registry('a) = "";
56+
57+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
58+ external getRunnable: appKey => option(runnable('a)) = "";
59+
860[@bs.module "react-native"] [@bs.scope "AppRegistry"]
9- external registerComponent: (string, unit => React.component('a)) => unit =
61+ external getSectionKeys: unit => array(string) = "";
62+
63+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
64+ external getSections: unit => Js.Dict.t(runnable('a)) = "";
65+
66+ // multiple externals
67+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
68+ external registerComponent: (appKey, componentProvider('a)) => unit = "";
69+
70+ // multiple externals
71+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
72+ external registerComponentWithSection:
73+ (appKey, componentProvider('a), section) => unit =
74+ "registerComponent";
75+
76+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
77+ external registerConfig: array(appConfig) => unit = "";
78+
79+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
80+ external registerRunnable: (appKey, appParameters => unit) => string = "";
81+
82+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
83+ external registerSection: (appKey, componentProvider('a)) => unit = "";
84+
85+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
86+ external runApplication: (appKey, 'a) => unit = "";
87+
88+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
89+ external setWrapperComponentProvider:
90+ wrapperComponentProvider('a, 'b) => unit =
1091 "";
1192
12- type task('data) = 'data => Js.Promise.t(unit);
93+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
94+ external unmountApplicationComponentAtRootTag: string => unit = "";
1395
96+ // Android only
1497[@bs.module "react-native"] [@bs.scope "AppRegistry"]
15- external registerHeadlessTask: (string, unit => task('data)) => unit = "";
98+ external cancelHeadlessTask: (taskId, taskKey) => unit = "";
99+
100+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
101+ external registerCancellableHeadlessTask:
102+ (taskKey, taskProvider('data), taskCancelProvider) => unit =
103+ "";
104+
105+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
106+ external registerHeadlessTask: (taskKey, taskProvider('data)) => unit = "";
107+
108+ [@bs.module "react-native"] [@bs.scope "AppRegistry"]
109+ external startHeadlessTask: (taskId, taskKey, 'data) => unit = "";
16110
17111// react-native-web
18112type app = {
@@ -21,7 +115,6 @@ type app = {
21115 [@bs.meth] "getStyleElement": unit => React.element,
22116};
23117[@bs.module "react-native"] [@bs.scope "AppRegistry"]
24- external getApplication: (string, {. "initialProps": 'a}) => app =
25- "";
118+ external getApplication: (string, {. "initialProps": 'a}) => app = "";
26119
27120```
0 commit comments