Can't get PTPeriodical to update

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't get PTPeriodical to update

Nick Brown
Hello folks.

I'm modifying a seaside application of mine so that parts of the UI will
periodically poll to see if anything's changed. I had a look at the
relevant section of the online seaside book, and it seems like
PTPeriodical is exactly what I want. Unfortunately I can't even get the
book's code example to work for me, so hopefully somebody can tell me
what I'm doing wrong.

I'm using the current Seaside/Pharo v3.0.7 one-click image from
seaside.st, and current stable releases of Firefox and Chrome (on
Windows). The following, applied to a fresh image, illustrates my
problem:

I create a WAComponent subclass, called MyTest.

I give it a class initialization method as follows:

initialize    
        super initialize.
        (WAAdmin register: self asApplicationAt: 'mytest')
                addLibrary: PTDeploymentLibrary;
                addLibrary: SUDeploymentLibrary.

(taken from
http://book.seaside.st/book/web-20/scriptaculous/frameworks/library )
And renderContentOn: as follows:

renderContentOn: html
        html div
                script: (html scriptaculous periodical
                        frequency: 1 second;
                        callback: [ :ajaxHtml | ajaxHtml render: Time
                        now ]
                );
                with: Time now.
               
(taken from
http://book.seaside.st/book/web-20/scriptaculous/ajax/background )      

I manually call the class initialzation method to register the
application, then visit it in a browser. I can see that the time does
update, but only once. Wireshark confirms only a single XMLHttpRequest
is coming back from the browser.

I'm afraid my Javascript debugging skills are largely non-existant, but
certainly the browser's JS console shows no errors or warnings.

I've tried explicitly calling #start on the PTPeriodical instance, in
which case I then get two XMLHttpRequests back from the browser in quick
succession, but still no ongoing periodical updates.

Grateful for any advice.

Cheers,
Nick Brown
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Can't get PTPeriodical to update

John McKeon
Hi Nick
I found it works if I remove the "second" i.e. frequency: 1;
In a workspace you can print "1 second" to see why it probably causes trouble.
 
Also, you do not want to send super initialize in a *class* initialize method. Just "one of those things". You can probably search the list archives to get a better explanation.
 
Happy Trails
John

On Mon, Aug 13, 2012 at 10:19 AM, Nick Brown <[hidden email]> wrote:
Hello folks.

I'm modifying a seaside application of mine so that parts of the UI will
periodically poll to see if anything's changed. I had a look at the
relevant section of the online seaside book, and it seems like
PTPeriodical is exactly what I want. Unfortunately I can't even get the
book's code example to work for me, so hopefully somebody can tell me
what I'm doing wrong.

I'm using the current Seaside/Pharo v3.0.7 one-click image from
seaside.st, and current stable releases of Firefox and Chrome (on
Windows). The following, applied to a fresh image, illustrates my
problem:

I create a WAComponent subclass, called MyTest.

I give it a class initialization method as follows:

initialize
        super initialize.
        (WAAdmin register: self asApplicationAt: 'mytest')
                addLibrary: PTDeploymentLibrary;
                addLibrary: SUDeploymentLibrary.

(taken from
http://book.seaside.st/book/web-20/scriptaculous/frameworks/library )
And renderContentOn: as follows:

renderContentOn: html
        html div
                script: (html scriptaculous periodical
                        frequency: 1 second;
                        callback: [ :ajaxHtml | ajaxHtml render: Time
                        now ]
                );
                with: Time now.

(taken from
http://book.seaside.st/book/web-20/scriptaculous/ajax/background )

I manually call the class initialzation method to register the
application, then visit it in a browser. I can see that the time does
update, but only once. Wireshark confirms only a single XMLHttpRequest
is coming back from the browser.

I'm afraid my Javascript debugging skills are largely non-existant, but
certainly the browser's JS console shows no errors or warnings.

I've tried explicitly calling #start on the PTPeriodical instance, in
which case I then get two XMLHttpRequests back from the browser in quick
succession, but still no ongoing periodical updates.

Grateful for any advice.

Cheers,
Nick Brown
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Can't get PTPeriodical to update

Nick Brown
In reply to this post by Nick Brown
Thanks John, that works fine, and good catch on the class initialization
- force of habit steering me wrong.

Cheers,
Nick

John McKeon writes:

>
>
> Hi Nick
> I found it works if I remove the "second" i.e. frequency: 1;
> In a workspace you can print "1 second" to see why it probably causes trouble.
>  
> Also, you do not want to send super initialize in a *class* initialize method. Just "one of those things". You can probably search the list archives to get a better explanation.
>  
> Happy Trails
> John
>
> On Mon, Aug 13, 2012, at 03:19 PM, Nick Brown wrote:
> > Hello folks.
> >
> > I'm modifying a seaside application of mine so that parts of the UI will
> > periodically poll to see if anything's changed. I had a look at the
> > relevant section of the online seaside book, and it seems like
> > PTPeriodical is exactly what I want. Unfortunately I can't even get the
> > book's code example to work for me, so hopefully somebody can tell me
> > what I'm doing wrong.
> >
> > I'm using the current Seaside/Pharo v3.0.7 one-click image from
> > seaside.st, and current stable releases of Firefox and Chrome (on
> > Windows). The following, applied to a fresh image, illustrates my
> > problem:
> >
> > I create a WAComponent subclass, called MyTest.
> >
> > I give it a class initialization method as follows:
> >
> > initialize    
> > super initialize.
> > (WAAdmin register: self asApplicationAt: 'mytest')
> > addLibrary: PTDeploymentLibrary;
> > addLibrary: SUDeploymentLibrary.
> >
> > (taken from
> > http://book.seaside.st/book/web-20/scriptaculous/frameworks/library )
> > And renderContentOn: as follows:
> >
> > renderContentOn: html
> > html div
> > script: (html scriptaculous periodical
> > frequency: 1 second;
> > callback: [ :ajaxHtml | ajaxHtml render: Time
> > now ]
> > );
> > with: Time now.
> >
> > (taken from
> > http://book.seaside.st/book/web-20/scriptaculous/ajax/background )      
> >
> > I manually call the class initialzation method to register the
> > application, then visit it in a browser. I can see that the time does
> > update, but only once. Wireshark confirms only a single XMLHttpRequest
> > is coming back from the browser.
> >
> > I'm afraid my Javascript debugging skills are largely non-existant, but
> > certainly the browser's JS console shows no errors or warnings.
> >
> > I've tried explicitly calling #start on the PTPeriodical instance, in
> > which case I then get two XMLHttpRequests back from the browser in quick
> > succession, but still no ongoing periodical updates.
> >
> > Grateful for any advice.
> >
> > Cheers,
> > Nick Brown
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside