Mercurial > urweb
annotate tests/ms.ur @ 2095:d9f918b79b5a
List.mem
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 23 Dec 2014 14:41:23 -0500 |
parents | 17393c5e2b90 |
children |
rev | line source |
---|---|
adam@1447 | 1 table ms : {Client : client, Channel : channel xbody} |
adam@1447 | 2 |
adam@1447 | 3 val hitMe = |
adam@1447 | 4 me <- self; |
adam@1447 | 5 ch <- oneRowE1 (SELECT (ms.Channel) |
adam@1447 | 6 FROM ms |
adam@1447 | 7 WHERE ms.Client = {[me]}); |
adam@1447 | 8 |
adam@1447 | 9 s <- source 0; |
adam@1447 | 10 send ch <xml> |
adam@1447 | 11 <dyn signal={n <- signal s; return <xml>{[n]}</xml>}/> |
adam@1447 | 12 <button value="Inc" onclick={n <- get s; set s (n + 1)}/> |
adam@1447 | 13 </xml> |
adam@1447 | 14 |
adam@1447 | 15 fun main' () = |
adam@1447 | 16 me <- self; |
adam@1447 | 17 ch <- channel; |
adam@1447 | 18 dml (INSERT INTO ms (Client, Channel) VALUES ({[me]}, {[ch]})); |
adam@1447 | 19 |
adam@1447 | 20 s <- source <xml/>; |
adam@1447 | 21 |
adam@1447 | 22 return <xml><body onload={let |
adam@1447 | 23 fun loop () = |
adam@1447 | 24 x <- recv ch; |
adam@1447 | 25 set s x; |
adam@1447 | 26 loop () |
adam@1447 | 27 in |
adam@1447 | 28 loop () |
adam@1447 | 29 end}> |
adam@1447 | 30 <button value="Another" onclick={rpc hitMe}/> |
adam@1447 | 31 <dyn signal={signal s}/> |
adam@1447 | 32 </body></xml> |
adam@1447 | 33 |
adam@1447 | 34 fun main () = |
adam@1447 | 35 return <xml><body><form><submit action={main'}/></form></body></xml> |