summaryrefslogtreecommitdiff
path: root/tests/goodbye.ur
diff options
context:
space:
mode:
Diffstat (limited to 'tests/goodbye.ur')
-rw-r--r--tests/goodbye.ur26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/goodbye.ur b/tests/goodbye.ur
new file mode 100644
index 00000000..1a466581
--- /dev/null
+++ b/tests/goodbye.ur
@@ -0,0 +1,26 @@
+table boo : { Client : client, Channel : channel unit }
+
+fun doIt () =
+ me <- self;
+ ch <- channel;
+ dml (INSERT INTO boo (Client, Channel) VALUES ({[me]}, {[ch]}));
+ return <xml><body onload={let
+ fun loop () =
+ v <- recv ch;
+ alert "Someone left";
+ loop ()
+ in
+ loop ()
+ end}/></xml>
+
+task clientLeaves = fn cl =>
+ debug "Client left";
+ dml (DELETE FROM boo WHERE Client = {[cl]});
+ queryI (SELECT (boo.Channel)
+ FROM boo)
+ (fn r => send r.1 ());
+ debug "Done processing"
+
+fun main () = return <xml><body>
+ <form> <submit action={doIt}/> </form>
+</body></xml>