annotate 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
rev   line source
adamc@590 1 cookie int : int
adamc@590 2
adamc@590 3 fun getOpt (t ::: Type) (o : option t) (v : t) : t =
adamc@590 4 case o of
adamc@590 5 None => v
adamc@590 6 | Some x => x
adamc@590 7
adamc@590 8 fun main () : transaction page =
adamc@590 9 n <- getCookie int;
adamc@590 10 sn <- source (getOpt n 7);
adamc@590 11 return <xml><body>
adamc@590 12 <dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
adamc@590 13 <a onclick={set sn 6}>CHANGE</a>
adamc@590 14 </body></xml>