From 6794c0f29032edbcd0b9b0844cd92bbde22d6702 Mon Sep 17 00:00:00 2001 From: Vincent Balat Date: Fri, 24 Nov 2023 15:53:47 +0100 Subject: [PATCH] Graffiti: create + register in two steps everywhere --- tutos/7.1/manual/application.wiki | 30 ++++++++++++++++++++++-------- tutos/dev/manual/application.wiki | 30 ++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/tutos/7.1/manual/application.wiki b/tutos/7.1/manual/application.wiki index 45551786..17ffbeb4 100644 --- a/tutos/7.1/manual/application.wiki +++ b/tutos/7.1/manual/application.wiki @@ -249,9 +249,13 @@ service (now at URL {{{/}}}): < Lwt.return (html @@ -376,9 +380,13 @@ open%shared Js_of_ocaml let%server count = ref 0 let%server main_service = - Graffiti_app.create + Eliom_service.create ~path:(Eliom_service.Path [""]) ~meth:(Eliom_service.Get Eliom_parameter.unit) + () + +let%server () = + Graffiti_app.register ~service:main_service (fun () () -> let c = incr count; !count in let text = Printf.sprintf "You came %i times to this page" in @@ -436,9 +444,13 @@ a copy of the {{{}}} element. Hence, the actual page's < let container = body [h1 [txt "Graffiti"]] in Eliom_service.onload {{ @@ -862,10 +874,8 @@ let%server page () = Replace {{{main_service}}} by: < (* Cf. section "Client side side-effects on the server" *) let page, cp_sig = page () in @@ -1040,9 +1050,13 @@ We also define a service that sends the picture: < Lwt.return (image_string (), "image/png")) >> diff --git a/tutos/dev/manual/application.wiki b/tutos/dev/manual/application.wiki index 45551786..17ffbeb4 100644 --- a/tutos/dev/manual/application.wiki +++ b/tutos/dev/manual/application.wiki @@ -249,9 +249,13 @@ service (now at URL {{{/}}}): < Lwt.return (html @@ -376,9 +380,13 @@ open%shared Js_of_ocaml let%server count = ref 0 let%server main_service = - Graffiti_app.create + Eliom_service.create ~path:(Eliom_service.Path [""]) ~meth:(Eliom_service.Get Eliom_parameter.unit) + () + +let%server () = + Graffiti_app.register ~service:main_service (fun () () -> let c = incr count; !count in let text = Printf.sprintf "You came %i times to this page" in @@ -436,9 +444,13 @@ a copy of the {{{}}} element. Hence, the actual page's < let container = body [h1 [txt "Graffiti"]] in Eliom_service.onload {{ @@ -862,10 +874,8 @@ let%server page () = Replace {{{main_service}}} by: < (* Cf. section "Client side side-effects on the server" *) let page, cp_sig = page () in @@ -1040,9 +1050,13 @@ We also define a service that sends the picture: < Lwt.return (image_string (), "image/png")) >>