Skip to content

Instantly share code, notes, and snippets.

@tobiasBora
Last active August 29, 2015 14:00
Show Gist options
  • Save tobiasBora/bb244fe31570ea82f8e8 to your computer and use it in GitHub Desktop.
Save tobiasBora/bb244fe31570ea82f8e8 to your computer and use it in GitHub Desktop.
{shared{
open Eliom_lib
open Eliom_content
open Html5.D
open Html5
}}
{shared{
let ( **> ) f x = f x
}}
let count = ref 0
let count_session = Eliom_reference.eref ~scope:Eliom_common.default_session_scope 0
(* The bug is for this one *)
let count_proc = Eliom_reference.eref ~scope:Eliom_common.default_process_scope 0
let count_req = Eliom_reference.eref ~scope:`Request 0
let page main_service () () =
incr count;
(lwt () = Eliom_reference.modify count_session succ in
lwt () = Eliom_reference.modify count_proc succ in
lwt () = Eliom_reference.modify count_req succ in
lwt c_session = Eliom_reference.get count_session in
lwt c_proc = Eliom_reference.get count_proc in
lwt c_req = Eliom_reference.get count_req in
Lwt.return
(Eliom_tools.F.html
~title:"mychat"
~css:[["css";"mychat.css"]]
Html5.F.(body [
h2 [pcdata "Wiki React"];
p [pcdata (Printf.sprintf "Ref : %d" !count)];
p [pcdata (Printf.sprintf "Eref session (browser) : %d" c_session)];
p [pcdata (Printf.sprintf "Eref proc (tab) : %d" c_session)];
p [pcdata (Printf.sprintf "Eref req : %d" c_req)];
a ~service:main_service [pcdata "Accueil"] ()
])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment