summaryrefslogtreecommitdiff
path: root/tests/jsinj.ur
blob: 194d26be9af4d160d3cd6b1f2e364362b7a71c99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
cookie int : int

fun getOpt (t ::: Type) (o : option t) (v : t) : t =
    case o of
        None => v
      | Some x => x

fun main () : transaction page =
    n <- getCookie int;
    sn <- source (getOpt n 7);
    return <xml><body>
      <dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
      <a onclick={set sn 6}>CHANGE</a>
    </body></xml>