[Seaside] Can't get PTPeriodical to update
nickbrown at fastmail.fm
Mon Aug 13 14:19:57 UTC 2012
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
I create a WAComponent subclass, called MyTest.
I give it a class initialization method as follows:
(WAAdmin register: self asApplicationAt: 'mytest')
And renderContentOn: as follows:
script: (html scriptaculous periodical
frequency: 1 second;
callback: [ :ajaxHtml | ajaxHtml render: Time
with: Time now.
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.
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.
More information about the seaside