Periodic JQuery updates on the coast

I use Seaside (2.8 in Squeak 4.2) and usually update as follows:

html div 
    onClick: ((html jQuery: '#asdf') load html: [:h|h text: 'qwer'])
    ; with: 'asdf'.

But this time I need to update the div periodically .

I used PT periodicalEvaluatorin another project, however in this I can not, I have to stick to JQ.

I tried using JQInstance delay:millisin all combinations that 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 happens instantly, and not after the 1000 milliseconds I need .

+5
source share
2 answers

Take a look at the example included in 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 ]

Example: here .

+4
source

jQuery delay [1].

, , Javascript setTimeout setInterval:

onClick: (((html jQuery id: 'chattertext') load html: [:h| self renderTextOn: h]) timeout: 1000)

[1] http://api.jquery.com/delay/

+1

All Articles