Mercurial > urweb
comparison tests/jsinj.ur @ 590:57f476c934da
Injecting an int
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 01 Jan 2009 15:11:17 -0500 |
parents | |
children | 8f8771f32909 |
comparison
equal
deleted
inserted
replaced
589:102e81d975e3 | 590:57f476c934da |
---|---|
1 cookie int : int | |
2 | |
3 fun getOpt (t ::: Type) (o : option t) (v : t) : t = | |
4 case o of | |
5 None => v | |
6 | Some x => x | |
7 | |
8 fun main () : transaction page = | |
9 n <- getCookie int; | |
10 sn <- source (getOpt n 7); | |
11 return <xml><body> | |
12 <dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/> | |
13 <a onclick={set sn 6}>CHANGE</a> | |
14 </body></xml> |