1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fun main () : transaction page = ch <- channel; let fun make () = subscribe ch; send ch "Hello world!" fun echo () = msg <- recv ch; alert(msg); echo () fun onload () = make (); echo () fun haveAnother () = send ch "Here's another." in return <xml><body onload={onload ()}> <button value="Another?" onclick={haveAnother ()}/> </body></xml> end