From 731a989ff4ab97f0ebedd6f23be1c10d70957dd5 Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Fri, 22 Mar 2024 17:21:08 +0100 Subject: [PATCH] BAckport to 7.1 --- tutos/7.1/manual/application.wiki | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/tutos/7.1/manual/application.wiki b/tutos/7.1/manual/application.wiki index 1b146f18..2080955d 100644 --- a/tutos/7.1/manual/application.wiki +++ b/tutos/7.1/manual/application.wiki @@ -16,6 +16,11 @@ introduction to Eliom programming. ==@@id="basics"@@ Basics== +If not already done, install Eliom first: +{{{ +opam install ocsipersist-sqlite eliom ocsigen-ppx-rpc +}}} + To get started, we recommend using <>, a program which creates scaffolds for Eliom projects. The following command creates a @@ -55,8 +60,7 @@ let%server () = Annotations {{{%server}}} tells the compiler that the code is going to be executed on the server (see later). -If you're using {{{eliom-distillery}}} just replace the content of file -{{{graffiti.eliom}}} by the above lines and run: +Replace the content of file {{{graffiti.eliom}}} by the above lines and run: <> <> <> that is the Js_of_ocaml's equivalent of as the JavaScript equivalent, hence not satisfactory. Js_of_ocaml's library provides a much easier way to do that with the help of Lwt. -To use this, add -{{{js_of_ocaml-lwt}}} to the {{{CLIENT_PACKAGES}}} -in {{{Makefile.options}}}, created by Eliom's distillery: -<> Then, replace the {{{init_client}}} of the previous example by the @@ -795,7 +796,8 @@ Finally, to interpret the draw orders read on the bus, we add the following line at the end of function {{{init_client}}}: < Lwt_stream.iter (draw ctx) (Eliom_bus.stream ~%bus)) + Lwt.async (fun () -> + Lwt_stream.iter (draw ctx) (Eliom_bus.stream ~%(bus : (messages, messages) Eliom_bus.t))) >> Now you can try the program using two browser windows to see that the @@ -847,9 +849,6 @@ opam install ocsigen-toolkit }}} Add package {{{ocsigen-toolkit.server}}} to the {{{libraries}}} section of your {{{dune}}} file, and {{{ocsigen-toolkit.client}}} to the {{{libraries}}} section of your {{{client/dune}}} file. -<> To create the widget, we replace {{{page}}} by :