From 2e29673fa970b814c97d5838963de49c2a65424b Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 7 Feb 2022 13:43:24 +0100 Subject: Rename application functions --- script.it/script.ml | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'script.it/script.ml') diff --git a/script.it/script.ml b/script.it/script.ml index 6c2b5d3..78a45b3 100755 --- a/script.it/script.ml +++ b/script.it/script.ml @@ -168,7 +168,7 @@ let set_sidebar let module M = struct type t = Layer.Paths.printer - let update t state = { state with State.rendering = t } + let process t state = { state with State.rendering = t } end in @@ -375,31 +375,23 @@ let page_main id = let delete_event = E.map (fun () -> let module Delete = Script_event.Delete in - State.E - ( Delete.{ worker } - , (module Delete: State.Event with type t = Delete.t ))) + State.dispatch (module Delete) Delete.{ worker }) parameters.delete and export_event = E.map (fun () -> let module Export = Script_event.Export in - State.E - ( () - , (module Export: State.Event with type t = Export.t ))) + State.dispatch (module Export ) ()) parameters.export and angle_event = S.changes parameters.angle |> E.map (fun value -> let module Property = Script_event.Property in - State.E - ( Property.{ value ; worker ; prop = `Angle } - , (module Property: State.Event with type t = Property.t ))) + State.dispatch (module Property) (Property.{ value ; worker ; prop = `Angle})) and width_event = S.changes parameters.width |> E.map (fun value -> let module Property = Script_event.Property in - State.E - ( Property.{ value ; worker ; prop = `Width } - , (module Property: State.Event with type t = Property.t ))) + State.dispatch (module Property) (Property.{ value ; worker ; prop = `Width })) and worker_event = Note.E.filter_map (function | `Other t -> @@ -408,9 +400,7 @@ let page_main id = | `Complete outline -> let module Complete_path = Script_event.Complete_path in Some ( - State.E - ( outline - , (module Complete_path: State.Event with type t = Complete_path.t )))) + State.dispatch (module Complete_path) outline)) worker_event in @@ -437,15 +427,11 @@ let page_main id = (function | `MouseDown c -> let module MouseDown = Script_event.Mouse_down in - State.E - ( MouseDown.{ position = c ; timer } - , (module MouseDown: State.Event with type t = MouseDown.t )) + State.dispatch (module MouseDown) MouseDown.{ position = c ; timer } | `Out c -> let module Click = Script_event.Click in - State.E - ( Click.{ point = c ; worker; timer } - , (module Click: State.Event with type t = Click.t )) + State.dispatch (module Click) Click.{ point = c ; worker ; timer } ) canva_events in let tick_event = -- cgit v1.2.3