view examples/countdown.ur @ 33:2e7f8f7d71d4

Update for Ur/Web's new tag name resolution
author Adam Chlipala <adam@chlipala.net>
date Thu, 21 Nov 2013 16:12:17 -0500
parents 2947170fcfd6
children
line wrap: on
line source
fun main () : transaction page =
    start <- now;
    deadline <- return (addSeconds start 60);
    cl <- Clock.create 500;
    return <xml><body onload={Clock.start cl}>
      <dyn signal={cl <- Clock.signal cl;
                   return <xml>
                     {[cl]}<br/>
                     {if cl > deadline then
                          <xml><b>Expired</b></xml>
                      else
                          <xml>{[diffInSeconds cl deadline]}</xml>}
                   </xml>}/>
    </body></xml>