comparison examples/remotePagerMain.ur @ 29:93140c5cc972

Clean up dependencies and examples; add Style module
author Adam Chlipala <adam@chlipala.net>
date Sat, 12 May 2012 10:03:44 -0400
parents examples/remotePager.ur@2e397d373289
children
comparison
equal deleted inserted replaced
28:7d0014542199 29:93140c5cc972
1 fun getPage pg =
2 return {Content = <xml><h2>This is page {[pg]}.</h2></xml>,
3 Available = 44}
4
5 structure Pager = RemotePager.Make(struct
6 type errorMarker = {}
7 type pageGroup = {}
8 val initPage = fn _ => getPage 0
9 val getPage = fn _ pg =>
10 tm <- now;
11 if mod (toSeconds tm) 5 = 0 then
12 return (RemotePager.Bad ())
13 else
14 p <- getPage pg;
15 return (RemotePager.Good p)
16 end)
17
18 fun main () =
19
20 pager <- Pager.create ();
21
22 return
23 <xml>
24 <head><title>RemotePager Example</title></head>
25 <body onload={Pager.onError pager (fn _ => alert "bad found")}>
26 <h1>RemotePager Example</h1>
27 <div>{Pager.panelXml pager}</div>
28 <div>{Pager.ctlXml pager}</div>
29 </body>
30 </xml>