view 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
line wrap: on
line source
fun getPage pg =
    return {Content = <xml><h2>This is page {[pg]}.</h2></xml>,
            Available = 44}

structure Pager = RemotePager.Make(struct
                                       type errorMarker = {}
                                       type pageGroup = {}
                                       val initPage = fn _ => getPage 0
                                       val getPage = fn _ pg =>
                                                        tm <- now;
                                                        if mod (toSeconds tm) 5 = 0 then
                                                            return (RemotePager.Bad ())
                                                        else
                                                            p <- getPage pg;
                                                            return (RemotePager.Good p)
                                   end)

fun main () =

    pager <- Pager.create ();

    return
    <xml>
      <head><title>RemotePager Example</title></head>
      <body onload={Pager.onError pager (fn _ => alert "bad found")}>
        <h1>RemotePager Example</h1>
        <div>{Pager.panelXml pager}</div>
        <div>{Pager.ctlXml pager}</div>
      </body>
    </xml>