comparison examples/remotePager.ur @ 16:2e397d373289

Add RemotePager.
author Karn Kallio <kkallio@eka>
date Thu, 18 Aug 2011 12:53:17 -0430
parents
children
comparison
equal deleted inserted replaced
15:8300d5f0dc19 16:2e397d373289
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>