diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-09 11:35:40 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-01-09 11:35:40 +0100 |
commit | 329b774e315b41bc0d5b7daf8737222768c8d1f3 (patch) | |
tree | 94464c12dfa48d5fdb1508b9e8a115b4596d0e34 /script.it/worker.ml | |
parent | c734c1b30fd1c58a0d42020859be31d89b92bcd0 (diff) |
Formalized exchanges between worker and app
Diffstat (limited to 'script.it/worker.ml')
-rwxr-xr-x | script.it/worker.ml | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/script.it/worker.ml b/script.it/worker.ml index 4ea9220..00e4595 100755 --- a/script.it/worker.ml +++ b/script.it/worker.ml @@ -1,11 +1,10 @@ open Js_of_ocaml -type message = [ - | `Complete of Path.Fixed.t - | `DeletePoint of (Path.Point.t * Path.Fixed.t) -] +let post_message + : Worker_messages.from_worker -> unit + = Worker.post_message -let execute (command: [> message]) = +let execute (command: [> Worker_messages.to_worker]) = match command with | `Complete path -> begin match Path.Fixed.rebuild path with @@ -17,8 +16,8 @@ let execute (command: [> message]) = | Some path -> Worker.post_message (`Complete path) | None -> () end - | any -> - Worker.post_message (`Other any) + | _ -> + post_message (`Other (Js.string "Unknown message received")) let () = Worker.set_onmessage execute |