[Seaside] A countdown in ajax

Bob Arning arning at charm.net
Sat Sep 18 16:18:41 UTC 2010

  If you want to do it from the seaside side, you could use Comet (the 
"self pusher" below).

When the question is rendered, start a timer:


     timerProcess := [
             (Delay forSeconds: howLong) wait.
             self pusher javascript: [ :script |
                 script << (script jQuery: #whatsHisName) load html: [ 
:h | ...update with new content...]
         timerProcess := nil.
     ] forkAt: Processor userBackgroundPriority.

If the timer expires, the

         script << (script jQuery: #whatsHisName) ...update with new 

could move to the next question. If the user answers before the time 
expires, then kill the timer and start a new one (if needed)

timerProcess terminate.
timerProcess := nil.
self startTimerProcess.


On 9/18/10 11:44 AM, Alberto Bacchelli wrote:
> Hi,
>  I am trying to implement a sort of questionnaire.
> There is one question per "page" (each page is simply
> a div element that is rendered or not), and each page
> has a time limit.
> This means that I would like to show an ajax countdown in the
> page, and I want to automatically change the page when the
> time expires.
> I have no idea on how to implement this,
> since in my opinion it would involve a separate
> thread that takes care of the timing issue.
> And I wouldn't know what's the way to deal with
> threads in seaside.
> Do you have any pointer/suggestion for me?
> Thank you,
>  Alberto
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100918/f63ba0f7/attachment-0001.htm

More information about the seaside mailing list