Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
742f86d2ee2f
Commit
ac30cbd4
authored
Jun 29, 2018
by
Laurent Wouters
Browse files
Adding new application framework
parent
e28c173f3b15
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/services/framework.ml
View file @
742f86d2
...
...
@@ -129,7 +129,7 @@ and appState =
|
Ready
of
appStateLoaded
(* The possible actions of an app *)
type
appAction
=
and
appAction
=
(* Some fetching is being requested *)
|
Request
of
requestedData
(* Some request has been launched *)
...
...
@@ -371,7 +371,7 @@ end
(* Module for rendering *)
module
Rendering
:
sig
(* Renders an application state *)
val
render
:
appState
->
ReasonReact
.
reactElement
val
get_view
:
appState
->
view
end
=
struct
(* Select the view if it is appropriate for this kind *)
let
best_of_1
(
view
:
view
)
(
kind
:
viewKind
)
=
match
view
.
specification
.
kind
,
kind
with
...
...
@@ -412,7 +412,7 @@ end = struct
|
_
->
RootView
(* Get the appropriate view and resources from the application state *)
let
get_view
state
=
match
state
with
let
do_
get_view
state
=
match
state
with
|
Init
(
registry
)
|
Loading
({
location
=
_
;
...
...
@@ -430,12 +430,10 @@ end = struct
let
kind
=
view_kind_for_resource
resource
in
select_view
registry
kind
(* Renders an application state *)
let
render
state
=
let
maybe_view
=
get_view
state
in
match
maybe_view
with
|
None
->
ReasonReact
.
null
|
Some
(
view
)
->
view
.
renderer
state
(* Get the appropriate view and resources from the application state *)
let
get_view
state
=
match
do_get_view
state
with
|
None
->
raise
(
BadState
"Could not find a view"
)
|
Some
(
view
)
->
view
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment