summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-02-07 13:43:47 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit6639625c1e24e764692ec9d65939ff9ef50d76df (patch)
tree099769a2b400309c3a509df294c3710fe5639536
parent47e4ab0cf1b7d364439a1a47df53f2d58a216239 (diff)
Rename application functions
-rwxr-xr-xeditor/actions/add_page.ml4
-rwxr-xr-xeditor/actions/delete_page.ml4
-rwxr-xr-xeditor/actions/editor_actions.ml4
-rwxr-xr-xeditor/actions/export.ml4
-rwxr-xr-xeditor/actions/import.ml4
-rwxr-xr-xeditor/actions/load_page.ml2
-rwxr-xr-xeditor/actions/to_markdown.ml4
-rw-r--r--editor/app/editor_app.ml4
-rw-r--r--editor/app/editor_app.mli5
-rwxr-xr-xeditor/editor.ml4
10 files changed, 21 insertions, 18 deletions
diff --git a/editor/actions/add_page.ml b/editor/actions/add_page.ml
index 1da8e3f..dff2c2f 100755
--- a/editor/actions/add_page.ml
+++ b/editor/actions/add_page.ml
@@ -10,7 +10,7 @@ module M = struct
= fun title ->
title
- let update
+ let process
: t -> State.t -> State.t
= fun {title} state ->
let page_id = key_of_title title in
@@ -36,7 +36,7 @@ let create
()
in
Note.E.map
- (fun v -> App.ev (module M) v)
+ (fun v -> App.dispatch (module M) v)
(* Option.on_some trigger the event only when the pop up is validated.
Closing the popup doesn't do anything.
*)
diff --git a/editor/actions/delete_page.ml b/editor/actions/delete_page.ml
index 858f6b9..2b75b2e 100755
--- a/editor/actions/delete_page.ml
+++ b/editor/actions/delete_page.ml
@@ -3,7 +3,7 @@ module M = struct
type t = unit
- let update
+ let process
: t -> State.t -> State.t
= fun () state ->
match state.page_id with
@@ -27,5 +27,5 @@ let create
()
in
Note.E.map
- (fun v -> App.ev (module M) v)
+ (fun v -> App.dispatch (module M) v)
(Note.E.Option.on_some ev)
diff --git a/editor/actions/editor_actions.ml b/editor/actions/editor_actions.ml
index 8ff2cab..eadf1e7 100755
--- a/editor/actions/editor_actions.ml
+++ b/editor/actions/editor_actions.ml
@@ -125,14 +125,14 @@ let build
Note.E.select
[ Evr.on_el
Ev.click
- (fun _ -> App.ev (module Load_page.M) None)
+ (fun _ -> App.dispatch (module Load_page.M) None)
home_button
; Evr.on_el
Ev.click
(fun ev ->
let el = Jv.Id.of_jv @@ Jv.Id.to_jv @@ Ev.target ev in
let name = El.at note_id_attribute el in
- App.ev (module Load_page.M) name)
+ App.dispatch (module Load_page.M) name)
ul ] in
let childs =
diff --git a/editor/actions/export.ml b/editor/actions/export.ml
index ea4f8ce..27c6a26 100755
--- a/editor/actions/export.ml
+++ b/editor/actions/export.ml
@@ -5,7 +5,7 @@ module M = struct
type t = unit
- let update
+ let process
: t -> State.t -> State.t
= fun _ state ->
@@ -33,4 +33,4 @@ end
(** Create a new element *)
let create
: unit -> App.event
- = fun () -> App.ev (module M) ()
+ = fun () -> App.dispatch (module M) ()
diff --git a/editor/actions/import.ml b/editor/actions/import.ml
index da74b50..b87960b 100755
--- a/editor/actions/import.ml
+++ b/editor/actions/import.ml
@@ -21,7 +21,7 @@ module M = struct
type t = Forms.Selector.t
- let update
+ let process
: t -> State.t -> State.t
= fun t state ->
match t.Forms.Selector.file with
@@ -54,5 +54,5 @@ let create () =
in
Note.E.map
- (fun v -> App.ev (module M) v)
+ (fun v -> App.dispatch (module M) v)
(Note.E.Option.on_some ev)
diff --git a/editor/actions/load_page.ml b/editor/actions/load_page.ml
index bcce51c..e85f8b5 100755
--- a/editor/actions/load_page.ml
+++ b/editor/actions/load_page.ml
@@ -2,7 +2,7 @@ module M = struct
type t = Jstr.t option
- let update
+ let process
: t -> State.t -> State.t
= fun page_id state ->
State.load_page page_id state
diff --git a/editor/actions/to_markdown.ml b/editor/actions/to_markdown.ml
index f3c6517..1920219 100755
--- a/editor/actions/to_markdown.ml
+++ b/editor/actions/to_markdown.ml
@@ -246,7 +246,7 @@ module ToMarkdown = struct
type t = PM.t
- let update
+ let process
: t -> State.t -> State.t
= fun pm state ->
@@ -291,4 +291,4 @@ end
let create
: PM.t -> App.event
= fun pm ->
- App.ev (module ToMarkdown) pm
+ App.dispatch (module ToMarkdown) pm
diff --git a/editor/app/editor_app.ml b/editor/app/editor_app.ml
index e4c944a..6bcfc4a 100644
--- a/editor/app/editor_app.ml
+++ b/editor/app/editor_app.ml
@@ -1,10 +1,12 @@
module App = Application.Make(struct type t = State.t end)
-let ev
+(*
+let dispatch
: (module App.Event with type t = 's) -> 's -> App.event
= fun (type s) (module M: App.Event with type t = s) v ->
App.E
( v
, (module M : App.Event with type t = M.t ))
+ *)
include App
diff --git a/editor/app/editor_app.mli b/editor/app/editor_app.mli
index dade546..aaa4d65 100644
--- a/editor/app/editor_app.mli
+++ b/editor/app/editor_app.mli
@@ -2,7 +2,7 @@ module type Event = sig
type t
- val update: t -> State.t -> State.t
+ val process: t -> State.t -> State.t
end
@@ -12,5 +12,6 @@ type event = E : 'a * (module Event with type t = 'a) -> event
val run
: ?eq:(State.t -> State.t -> bool) -> State.t -> event Note.E.t -> State.t Note.S.t
-val ev
+val dispatch
: (module Event with type t = 's) -> 's -> event
+
diff --git a/editor/editor.ml b/editor/editor.ml
index ee2ee0d..575e164 100755
--- a/editor/editor.ml
+++ b/editor/editor.ml
@@ -60,7 +60,7 @@ let build_view
module Store = struct
type t = El.t
- let update
+ let process
: t -> State.t -> State.t
= fun title_element state ->
let title = El.prop (El.Prop.value) title_element in
@@ -145,7 +145,7 @@ let app id content =
init_state
(Note.E.select
[ Brr_note.Evr.on_els Ev.focusout
- (fun _ _ -> App.ev (module Store) title)
+ (fun _ _ -> App.dispatch (module Store) title)
[ editor ; title ]
; btn_events
]) in