diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-04-09 20:00:52 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-04-09 20:00:52 -0400 |
commit | 27e97143b6e20274484289ad61bfd9eb1922d50a (patch) | |
tree | afc1aa975eca7a387cdc88de716b920780ba4c89 /tests | |
parent | 51b2033057b25f4cecd3d5e73dc49b60b532834e (diff) |
Send newly created sources with messages to clients
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ms.ur | 35 | ||||
-rw-r--r-- | tests/ms.urp | 4 | ||||
-rw-r--r-- | tests/ms.urs | 1 |
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/ms.ur b/tests/ms.ur new file mode 100644 index 00000000..3dcc48cf --- /dev/null +++ b/tests/ms.ur @@ -0,0 +1,35 @@ +table ms : {Client : client, Channel : channel xbody} + +val hitMe = + me <- self; + ch <- oneRowE1 (SELECT (ms.Channel) + FROM ms + WHERE ms.Client = {[me]}); + + s <- source 0; + send ch <xml> + <dyn signal={n <- signal s; return <xml>{[n]}</xml>}/> + <button value="Inc" onclick={n <- get s; set s (n + 1)}/> + </xml> + +fun main' () = + me <- self; + ch <- channel; + dml (INSERT INTO ms (Client, Channel) VALUES ({[me]}, {[ch]})); + + s <- source <xml/>; + + return <xml><body onload={let + fun loop () = + x <- recv ch; + set s x; + loop () + in + loop () + end}> + <button value="Another" onclick={rpc hitMe}/> + <dyn signal={signal s}/> + </body></xml> + +fun main () = + return <xml><body><form><submit action={main'}/></form></body></xml> diff --git a/tests/ms.urp b/tests/ms.urp new file mode 100644 index 00000000..83ae5847 --- /dev/null +++ b/tests/ms.urp @@ -0,0 +1,4 @@ +database dbname=test +sql ms.sql + +ms diff --git a/tests/ms.urs b/tests/ms.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/ms.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |