[Seaside] [Q] auto - refresh and live update

Jason Rogers jacaetevha at gmail.com
Mon May 9 16:08:14 CEST 2005


Thanks Danie.  I have been looking for this same functionality for a
while as well.  This should be in the FAQ somewhere.  I've never even
run across the "how to build a live URL" in documentation anywhere. 
Perhaps I have just missed it all this time.

On 5/6/05, Danie Roux <droux at tuks.co.za> wrote:
> On Fri, May 06, 2005 at 11:03:43PM +0200, Brent Pinkney wrote:
> > Hi,
> >
> > Is it possible to have portion of a web page automaticaly refresh itself
> > after n seconds without reloading the entire page ?
> 
> Brent,
> 
> This is how I've done it. Drastically condensed, hoping that I'm still
> keeping the meaning intact :)
> 
> renderContentOn: html
>         html divNamed: 'live_update'
>                 with: [
>                         " Create uri for the live action "
>                         uri _ html urlForLiveRequest: [:t :h |
>                                         h divNamed: 'live_update' with: [
>                                                  " live action should occur in here, writing to h "
>                                         ].
>                                 ].
>                         " Start of automatic updates "
>                         html script: 'timedUpdate(', uri asString printString ,')'.
>                 ].
> 
> and then this helper JavaScript function:
> 
> script
>         ^'
> // This takes a uriFunc creator, creates the function and executes it.
> function timedUpdate(uriFunc) {
>         var updater = liveUpdaterUri(uriFunc);
>         updater();
>         var again = "timedUpdate(\""+uriFunc+"\")";
>         setTimeout(again, 2000);
> }
> .
> 
> Adjust the parameter to setTimeout to set the frequency.
> 
> --
> Danie Roux *shuffle* Adore Unix
> 
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
> 


-- 
Jason Rogers

"I am crucified with Christ: nevertheless I live; yet not I,
but Christ liveth in me: and the life which I now live in 
the flesh I live by the faith of the Son of God, who loved 
me, and gave himself for me."
    Galatians 2:20


More information about the Seaside mailing list