From c46e68076400c00778dcc4e6790ffd59bb726e03 Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Wed, 20 Dec 2023 21:18:36 +0100 Subject: [PATCH] basics: add client-server build schema --- tutos/dev/manual/basics.wiki | 13 +- .../manual/files/tutorial/client-server.svg | 684 ++++++++++++++++++ 2 files changed, 696 insertions(+), 1 deletion(-) create mode 100644 tutos/dev/manual/files/tutorial/client-server.svg diff --git a/tutos/dev/manual/basics.wiki b/tutos/dev/manual/basics.wiki index 6b15fd05..d5607c2d 100644 --- a/tutos/dev/manual/basics.wiki +++ b/tutos/dev/manual/basics.wiki @@ -536,7 +536,18 @@ PPX annotations allow to split the code into these two programs: Same for {{{module%shared}}}, {{{open%shared}}}, {{{type%shared}}} etc. +{{@@class="doc-img-col-width"@@files/tutorial/client-server.svg|Client-server build system}} + ===Client values=== +Fragments of client code can be included in server (or shared) sections. + +Example: + +< ... ]] [ ... ] + >> + + Client values can be declared within server or shared code as {{{[%client[ ( : ) ]}}}. The type annotation is almost always required. @@ -735,7 +746,7 @@ Attributes like {{{a_onclick}}} in module {{{Eliom_content.Html.D}}} or {{{F}}} take a client side function as parameter: < ... ]] [ ... ] +button ~a:[a_onclick [%client fun ev -> ... ]] [ ... ] >> Module {{{Lwt_js_events}}} of Js_of_ocaml defines a way to bind browser events diff --git a/tutos/dev/manual/files/tutorial/client-server.svg b/tutos/dev/manual/files/tutorial/client-server.svg new file mode 100644 index 00000000..559552e2 --- /dev/null +++ b/tutos/dev/manual/files/tutorial/client-server.svg @@ -0,0 +1,684 @@ + + + + + + + + + + + + + + + + + + + + + + + + + let%server + + + + + + + + let%client + + + + + + + + let%shared + + + + + + + + + let%server + + + + + + + + let%shared + + + + + + + + + let%client + + + + + + + + let%shared + + + + + + + + + + + + + + + ppx + ppx + + client-server type-checking + ocamlopt + js_of_ocaml + .cmxs + .js + .eliom + +