[Seaside] Can't get PTPeriodical to update

Nick Brown nickbrown at fastmail.fm
Mon Aug 13 14:19:57 UTC 2012


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


More information about the seaside mailing list