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
ea912901e67f
Commit
0702a647
authored
Jun 29, 2018
by
Laurent Wouters
Browse files
Adding new application framework
parent
2ea315e9ec59
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/services/framework.ml
View file @
ea912901
...
...
@@ -164,6 +164,9 @@ module States : sig
(* When the state has changed *)
val
on_updated
:
(
appState
,
'
retainedProps
,
appAction
)
ReasonReact
.
oldNewSelf
->
unit
(* Gets the root resource from an application state *)
val
root_resource
:
appState
->
resource
end
=
struct
(* Fold fetched data into a map of resources *)
let
append_resource
fetchedData
(
resources
:
resource
StringMap
.
t
)
=
...
...
@@ -182,6 +185,22 @@ end = struct
StringMap
.
add
target
{
path
=
target
;
schema
=
None
;
data
=
Some
(
data
)}
resources
|
_
->
resources
(* Gets the root resource from an application state *)
let
root_resource
(
state
:
appState
)
=
match
state
with
|
Init
(
_
)
|
Failed
(
_
)
->
raise
(
BadState
"Expected state Loading or Ready"
)
|
Loading
({
location
=
location
;
loaded
=
resources
;
requested
=
_
;
registry
=
_
;
})
|
Ready
({
location
=
location
;
resources
=
resources
;
registry
=
_
;
})
->
StringMap
.
find
location
resources
(* Get the initial state for the application *)
let
initial_state
viewRegistry
=
Init
(
viewRegistry
)
...
...
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