annotate examples/remotePager.ur @ 22:4362b15220e4

Comment corrections based on code review.
author Karn Kallio <kkallio@eka>
date Mon, 22 Aug 2011 05:06:15 -0430
parents 2e397d373289
children
rev   line source
kkallio@16 1 fun getPage pg =
kkallio@16 2 return {Content = <xml><h2>This is page {[pg]}.</h2></xml>,
kkallio@16 3 Available = 44}
kkallio@16 4
kkallio@16 5 structure Pager = RemotePager.Make(struct
kkallio@16 6 type errorMarker = {}
kkallio@16 7 type pageGroup = {}
kkallio@16 8 val initPage = fn _ => getPage 0
kkallio@16 9 val getPage = fn _ pg =>
kkallio@16 10 tm <- now;
kkallio@16 11 if mod (toSeconds tm) 5 = 0 then
kkallio@16 12 return (RemotePager.Bad ())
kkallio@16 13 else
kkallio@16 14 p <- getPage pg;
kkallio@16 15 return (RemotePager.Good p)
kkallio@16 16 end)
kkallio@16 17
kkallio@16 18 fun main () =
kkallio@16 19
kkallio@16 20 pager <- Pager.create ();
kkallio@16 21
kkallio@16 22 return
kkallio@16 23 <xml>
kkallio@16 24 <head><title>RemotePager Example</title></head>
kkallio@16 25 <body onload={Pager.onError pager (fn _ => alert "bad found")}>
kkallio@16 26 <h1>RemotePager Example</h1>
kkallio@16 27 <div>{Pager.panelXml pager}</div>
kkallio@16 28 <div>{Pager.ctlXml pager}</div>
kkallio@16 29 </body>
kkallio@16 30 </xml>