From 899924e800b9721ffc53802d158e00fe0e8917f2 Mon Sep 17 00:00:00 2001 From: balat Date: Fri, 8 Mar 2024 14:19:58 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20ocsigen/?= =?UTF-8?q?tuto@789532462e4f766cdfed349d719371f6b7163c69=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 7.1/manual/basics-server.html | 2 +- 7.1/manual/basics.html | 11 +- .../files/tutorial/client-server-req.svg | 190 ++++++++++-------- dev/manual/basics-server.html | 2 +- dev/manual/basics.html | 11 +- .../files/tutorial/client-server-req.svg | 190 ++++++++++-------- 6 files changed, 226 insertions(+), 180 deletions(-) diff --git a/7.1/manual/basics-server.html b/7.1/manual/basics-server.html index 4a1260f9..e8f71e7d 100644 --- a/7.1/manual/basics-server.html +++ b/7.1/manual/basics-server.html @@ -106,7 +106,7 @@

Module Eliom_registration.Html_text is used to register a service sending HTML as strings. But we recommend to used typed-HTML instead (see below).

Compiling

Eliom provides an helper program called eliom-distillery to create your projects easily, with the right dune configuration and all default directories you usually need for a Web application (static files, server logs, database, etc.). We will show how to use eliom-distillery in another section below.

In this section, we will show how to compile and run a server-side only Web site by creating your project manually. -

opam install eliom
+

opam install ocsipersist-sqlite eliom
 dune init proj --kind=lib mysite
 cd mysite
 

Add (libraries eliom.server) into file lib/dune, in the library section. diff --git a/7.1/manual/basics.html b/7.1/manual/basics.html index 0be950a7..90d6ed2f 100644 --- a/7.1/manual/basics.html +++ b/7.1/manual/basics.html @@ -188,7 +188,7 @@ ["dir" ; "image.jpg"]) ()

Compiling

Eliom provides an helper program called eliom-distillery to create your projects easily, with the right dune configuration and all default directories you usually need for a Web application (static files, server logs, database, etc.). We will show how to use eliom-distillery in another section below.

In this section, we will show how to compile and run a server-side only Web site by creating your project manually. -

opam install eliom
+

opam install ocsipersist-sqlite eliom
 dune init proj --kind=lib mysite
 cd mysite
 

Add (libraries eliom.server) into file lib/dune, in the library section. @@ -359,12 +359,9 @@ Type annotation is almost always required.

These client fragments can be manipulated as server side OCaml values:

let%server x : int Eliom_client_value.t = [%client 1 + 3 ]

If such section is reached while generating a page on server side, -the client-side code will be executed once the page is displayed. +the client-side code will be executed when the page is displayed.

If such section is reached while generating a page on client side, the client-side code will be executed immediately -(In that case, you can delay the execution, if needed, -for example with function -Ot_nodeready.nodeready to wait for the element to be actually displayed).

If such section is reached during module initialization on the server (global client section), it will be executed on client side everytime a new client side program is launched. @@ -396,7 +393,9 @@

  • then the user clicks on a link in the page, and the page is generated by the client-side program (because the service is registered on both sides). In this example, while generating the page, the client does a RPC to the server.
  • In both cases (first request or RPC), the server returns the expected value, but also the value of injections and an order for the client-side program to execute the client-values met during te server-side computation.

    Example of requests -

    Tip: You can avoid waiting for the RPC to return by using a spinner from Ocsigen Toolkit. Thus, the client-side generated page will be displayed without delay. +

    Tip 1: You can avoid waiting for the RPC to return by using a spinner from Ocsigen Toolkit (see module Ot_spinner). Thus, the client-side generated page will be displayed without delay. +

    Tip 2: To delay the execution of a client fragment after the page is actually displayed, you might want to use function +Ot_nodeready.nodeready from Ocsigen Toolkit.

    Regardless of the construction used and their combination, there is only one communication from server to client, when the Web page is sent. This is due to the fact that client values are not executed diff --git a/7.1/manual/files/tutorial/client-server-req.svg b/7.1/manual/files/tutorial/client-server-req.svg index 72794080..1843e430 100644 --- a/7.1/manual/files/tutorial/client-server-req.svg +++ b/7.1/manual/files/tutorial/client-server-req.svg @@ -168,6 +168,25 @@ style="fill:context-stroke;fill-rule:evenodd;stroke:none" id="path1367-6-5" /> + + + page generation let%rpc f (x : int) : int = ... ... [%client ... ~%b ... ] [%client ... ~%b ... ] Lwt.return v + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.93889px;font-family:monospace;-inkscape-font-specification:'monospace Bold';fill:#5599ff;stroke-width:3" + x="127.30164" + y="46.187405" + id="tspan5572"> Lwt.return v ... [%client ... ~%a ... ] Lwt.return (html (...) (...)) + x="21.868446" + y="21.257185" + id="tspan5568-1">...[%client ... ~%a ... ]Lwt.return (html (...) (...)) client valuesclient fragments[%client ... ~%a ...] execution of client valuesclient fragments[%client ... ~%b ...] rpc + x="138.1821" + y="110.16544">rpc jshtmljs ++ ~% injections html + + y="75.036996" + id="tspan1359">+ injections ~%a value vvalue v+ ~% injections + id="tspan3313-8">+ injections ~%b + y="113.33432" /> page generation + y="120.33778">page generation + diff --git a/dev/manual/basics-server.html b/dev/manual/basics-server.html index 3c502547..1a83a752 100644 --- a/dev/manual/basics-server.html +++ b/dev/manual/basics-server.html @@ -106,7 +106,7 @@

    Module Eliom_registration.Html_text is used to register a service sending HTML as strings. But we recommend to used typed-HTML instead (see below).

    Compiling

    Eliom provides an helper program called eliom-distillery to create your projects easily, with the right dune configuration and all default directories you usually need for a Web application (static files, server logs, database, etc.). We will show how to use eliom-distillery in another section below.

    In this section, we will show how to compile and run a server-side only Web site by creating your project manually. -

    opam install eliom
    +

    opam install ocsipersist-sqlite eliom
     dune init proj --kind=lib mysite
     cd mysite
     

    Add (libraries eliom.server) into file lib/dune, in the library section. diff --git a/dev/manual/basics.html b/dev/manual/basics.html index cd23b4e2..7e7b3179 100644 --- a/dev/manual/basics.html +++ b/dev/manual/basics.html @@ -188,7 +188,7 @@ ["dir" ; "image.jpg"]) ()

    Compiling

    Eliom provides an helper program called eliom-distillery to create your projects easily, with the right dune configuration and all default directories you usually need for a Web application (static files, server logs, database, etc.). We will show how to use eliom-distillery in another section below.

    In this section, we will show how to compile and run a server-side only Web site by creating your project manually. -

    opam install eliom
    +

    opam install ocsipersist-sqlite eliom
     dune init proj --kind=lib mysite
     cd mysite
     

    Add (libraries eliom.server) into file lib/dune, in the library section. @@ -359,12 +359,9 @@ Type annotation is almost always required.

    These client fragments can be manipulated as server side OCaml values:

    let%server x : int Eliom_client_value.t = [%client 1 + 3 ]

    If such section is reached while generating a page on server side, -the client-side code will be executed once the page is displayed. +the client-side code will be executed when the page is displayed.

    If such section is reached while generating a page on client side, the client-side code will be executed immediately -(In that case, you can delay the execution, if needed, -for example with function -Ot_nodeready.nodeready to wait for the element to be actually displayed).

    If such section is reached during module initialization on the server (global client section), it will be executed on client side everytime a new client side program is launched. @@ -396,7 +393,9 @@

  • then the user clicks on a link in the page, and the page is generated by the client-side program (because the service is registered on both sides). In this example, while generating the page, the client does a RPC to the server.
  • In both cases (first request or RPC), the server returns the expected value, but also the value of injections and an order for the client-side program to execute the client-values met during te server-side computation.

    Example of requests -

    Tip: You can avoid waiting for the RPC to return by using a spinner from Ocsigen Toolkit. Thus, the client-side generated page will be displayed without delay. +

    Tip 1: You can avoid waiting for the RPC to return by using a spinner from Ocsigen Toolkit (see module Ot_spinner). Thus, the client-side generated page will be displayed without delay. +

    Tip 2: To delay the execution of a client fragment after the page is actually displayed, you might want to use function +Ot_nodeready.nodeready from Ocsigen Toolkit.

    Regardless of the construction used and their combination, there is only one communication from server to client, when the Web page is sent. This is due to the fact that client values are not executed diff --git a/dev/manual/files/tutorial/client-server-req.svg b/dev/manual/files/tutorial/client-server-req.svg index 72794080..1843e430 100644 --- a/dev/manual/files/tutorial/client-server-req.svg +++ b/dev/manual/files/tutorial/client-server-req.svg @@ -168,6 +168,25 @@ style="fill:context-stroke;fill-rule:evenodd;stroke:none" id="path1367-6-5" /> + + + page generation let%rpc f (x : int) : int = ... ... [%client ... ~%b ... ] [%client ... ~%b ... ] Lwt.return v + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.93889px;font-family:monospace;-inkscape-font-specification:'monospace Bold';fill:#5599ff;stroke-width:3" + x="127.30164" + y="46.187405" + id="tspan5572"> Lwt.return v ... [%client ... ~%a ... ] Lwt.return (html (...) (...)) + x="21.868446" + y="21.257185" + id="tspan5568-1">...[%client ... ~%a ... ]Lwt.return (html (...) (...)) client valuesclient fragments[%client ... ~%a ...] execution of client valuesclient fragments[%client ... ~%b ...] rpc + x="138.1821" + y="110.16544">rpc jshtmljs ++ ~% injections html + + y="75.036996" + id="tspan1359">+ injections ~%a value vvalue v+ ~% injections + id="tspan3313-8">+ injections ~%b + y="113.33432" /> page generation + y="120.33778">page generation +