diff options
author | Adam Chlipala <adam@chlipala.net> | 2016-06-16 11:00:01 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2016-06-16 11:00:01 -0400 |
commit | f050c7f1de1fe03e2253f408445a69e9402f60ee (patch) | |
tree | ca6e66fda36d8445e34ba396394ba5a3dcfa1a39 /tests/timeout.ur | |
parent | 6dad7c645d8fdb7b7237c89ff7b34e90adbb86b1 (diff) |
Client-side: detect session timeout and ask the user to reload
Diffstat (limited to 'tests/timeout.ur')
-rw-r--r-- | tests/timeout.ur | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/timeout.ur b/tests/timeout.ur new file mode 100644 index 00000000..d96b42bd --- /dev/null +++ b/tests/timeout.ur @@ -0,0 +1,22 @@ +table listeners : { Ch : channel unit } + +fun ping () = + queryI1 (SELECT * FROM listeners) + (fn r => send r.Ch ()) + +fun main () = + ch <- channel; + dml (INSERT INTO listeners(Ch) VALUES ({[ch]})); + count <- source 0; + return <xml><body onload={let + fun loop () = + _ <- recv ch; + c <- get count; + set count (c + 1); + loop () + in + loop () + end}> + <dyn signal={n <- signal count; return (txt n)}/> + <button onclick={fn _ => rpc (ping ())}>Ping</button> + </body></xml> |