Skip to content

Commit c46e680

Browse files
committed
basics: add client-server build schema
1 parent 6794c0f commit c46e680

File tree

2 files changed

+696
-1
lines changed

2 files changed

+696
-1
lines changed

tutos/dev/manual/basics.wiki

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,18 @@ PPX annotations allow to split the code into these two programs:
536536

537537
Same for {{{module%shared}}}, {{{open%shared}}}, {{{type%shared}}} etc.
538538

539+
{{@@class="doc-img-col-width"@@files/tutorial/client-server.svg|Client-server build system}}
540+
539541
===Client values===
542+
Fragments of client code can be included in server (or shared) sections.
543+
544+
Example:
545+
546+
<<code language="ocaml" class="server"|
547+
button ~a:[a_onclick [%client fun ev -> ... ]] [ ... ]
548+
>>
549+
550+
540551
Client values can be declared within server or shared code as
541552
{{{[%client[ (<value> : <type>) ]}}}.
542553
The type annotation is almost always required.
@@ -735,7 +746,7 @@ Attributes like {{{a_onclick}}} in module {{{Eliom_content.Html.D}}} or {{{F}}}
735746
take a client side function as parameter:
736747

737748
<<code language="ocaml" class="shared"|
738-
div ~a:[a_onclick [%client fun ev -> ... ]] [ ... ]
749+
button ~a:[a_onclick [%client fun ev -> ... ]] [ ... ]
739750
>>
740751

741752
Module {{{Lwt_js_events}}} of Js_of_ocaml defines a way to bind browser events

0 commit comments

Comments
 (0)