Commit 7742a4a9 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

Adding new application framework

parent 15e9148bc0a0
......@@ -16,13 +16,11 @@ let make = _children => {
self.send(Framework.GoTo(Framework.path_to_str(url.path)));
},
initialState: () => {
let registry = Defaults.defaultRegistry;
let registry = Defaults.defaultRegistry();
Framework.States.initial_state(registry);
},
reducer: Framework.States.reduce,
didUpdate: oldNewSelf => Framework.States.on_updated(oldNewSelf),
render: self => {
let view = Framework.Rendering.get_view(self.state);
},
render: self =>
Framework.DefaultRenderer.render(self, Defaults.defaultRenderer),
};
\ No newline at end of file
......@@ -108,4 +108,72 @@ let defaultRegistry = () : Framework.viewRegistry =>
"::defaults::Entity",
"::defaults::Entity",
),
]);
\ No newline at end of file
]);
let defaultRenderer =
Framework.DefaultRenderer.empty
|> Framework.DefaultRenderer.register(
"::defaults::Loading",
(
self:
ReasonReact.self(
Framework.appState,
ReasonReact.noRetainedProps,
Framework.appAction,
),
state: Framework.appState,
) =>
renderLoading(self, state)
)
|> Framework.DefaultRenderer.register(
"::defaults::Failed",
(
self:
ReasonReact.self(
Framework.appState,
ReasonReact.noRetainedProps,
Framework.appAction,
),
state: Framework.appState,
) =>
renderFailed(self, state)
)
|> Framework.DefaultRenderer.register(
"::defaults::Root",
(
self:
ReasonReact.self(
Framework.appState,
ReasonReact.noRetainedProps,
Framework.appAction,
),
state: Framework.appState,
) =>
renderRoot(self, state)
)
|> Framework.DefaultRenderer.register(
"::defaults::Collection",
(
self:
ReasonReact.self(
Framework.appState,
ReasonReact.noRetainedProps,
Framework.appAction,
),
state: Framework.appState,
) =>
renderCollection(self, state)
)
|> Framework.DefaultRenderer.register(
"::defaults::Entity",
(
self:
ReasonReact.self(
Framework.appState,
ReasonReact.noRetainedProps,
Framework.appAction,
),
state: Framework.appState,
) =>
renderEntity(self, state)
);
\ No newline at end of file
......@@ -510,4 +510,12 @@ module Create = struct
(fun registry view -> register_view registry view)
{specifications=StringMap.empty; definitions=StringMap.empty;}
views
end
\ No newline at end of file
end
module DefaultRendererT = struct
type t = (appState, ReasonReact.noRetainedProps, appAction) ReasonReact.self
let state (self: t) = self.state
end
module DefaultRenderer = Renderer(DefaultRendererT);;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment