summaryrefslogtreecommitdiff
path: root/tests/timeout.ur
blob: d96b42bdc4828b148a32e88dcfcbe2cc155b78d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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>