I am using Seaside (2.8 in Squeak 4.2) and am normally updating like this:
html div
onClick: ((html jQuery: '#asdf') load html: [:h|h text: 'qwer'])
; with: 'asdf'.
But this time, i have to update a div periodically.
I have used PT's periodicalEvaluator
in another project, however in this one I can not, I have to stick to JQ.
I tried to use JQInstance's delay:millis
in all combinations i could think of:
onClick: (((html jQuery id: 'chattertext') delay: 1000; yourself) load html: [:h| self renderTextOn: h])
; onClick: (((html jQuery id: 'chattertext') delay: 1000) load html: [:h| self renderTextOn: h])
; onClick: (((html jQuery id: 'chattertext') delay: 1000; load) html: [:h| self renderTextOn: h])
and others
for some reason the update is instantaneous instead of after 1000 millis which i need.
Have a look at the example coming with the JQuery functional test suite:
JQRepeatingFunctionalTest>>#renderContentOn: html
html paragraph
script: (html jQuery this load
html: [ :r | self renderTimeOn: r ];
interval: 1 seconds);
with: [ self renderTimeOn: html ]
The example is running here.
jQuery's delay
function only applies to effects [1].
To achieve what you want, just use Javascript's setTimeout or setInterval functions:
onClick: (((html jQuery id: 'chattertext') load html: [:h| self renderTextOn: h]) timeout: 1000)
[1] http://api.jquery.com/delay/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With