我正在使用Seaside(Squeak 4.2中的2.8),我通常会像这样更新:
html div onClick: ((html jQuery: '#asdf') load html: [:h|h text: 'qwer']) ; with: 'asdf'.
但这一次,我必须定期更新div.
我在另一个项目中使用了PT的periodicalEvaluator,但是在这个我不能,我必须坚持使用JQ.
我尝试使用JQInstance的延迟:millis在我能想到的所有组合中:
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
出于某种原因,更新是瞬时的,而不是在我需要的1000毫秒之后.
解决方法
看看JQuery功能测试套件附带的示例:
JQRepeatingFunctionalTest>>#renderContentOn: html html paragraph script: (html jQuery this load html: [ :r | self renderTimeOn: r ]; interval: 1 seconds); with: [ self renderTimeOn: html ]
该示例运行here.