Mercurial > urweb
annotate tests/rpc2.ur @ 1708:e263dab7b579
Optimize code from last changeset a bit
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 08 Apr 2012 16:29:28 -0400 |
parents | c5991cdb0c4b |
children |
rev | line source |
---|---|
adamc@613 | 1 sequence s |
adamc@613 | 2 sequence s2 |
adamc@613 | 3 |
adamc@613 | 4 fun dint src = n <- signal src; return <xml>{[n]}</xml> |
adamc@613 | 5 |
adamc@613 | 6 fun main () : transaction page = |
adamc@613 | 7 let |
adamc@613 | 8 fun getNext () = |
adamc@613 | 9 n <- nextval s; |
adamc@613 | 10 n2 <- nextval s2; |
adamc@613 | 11 return (n, n2) |
adamc@613 | 12 in |
adamc@613 | 13 src1 <- source 0; |
adamc@613 | 14 src2 <- source 0; |
adamc@613 | 15 return <xml><body> |
adamc@613 | 16 <button value="Get It On!" |
adamc@613 | 17 onclick={p <- getNext (); |
adamc@613 | 18 case p of |
adamc@613 | 19 (n1, n2) => set src1 n1; |
adamc@613 | 20 set src2 n2}/> |
adamc@613 | 21 <br/> |
adamc@613 | 22 Current1: <dyn signal={dint src1}/> |
adamc@613 | 23 Current2: <dyn signal={dint src2}/> |
adamc@613 | 24 </body></xml> |
adamc@613 | 25 end |