Squeak and Reverse Ajax

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Squeak and Reverse Ajax

Rob Rothwell
I think this is more of a Squeak Process question than an Aida question, but I'm not sure.

I am still trying to "Reverse Ajax" an application using Squeak and Aida.

Trust that I have a CustomAnnouncement that works.

I have an application, MyApp, with a 10 second Ajax resolution and a 1 second event resolution as follows: 

MyApp>>viewMain
|e|
e:=WebElement new.
        e add: (self liveContent updateEverySeconds: 10).
self pageFrameWith: e title: 'My Application'.

simple enough.  "Every 10 seconds do something."

Where, just to see something happening I have

MyApp>>liveContent
  |e|
self session lastRequest isAjaxRequest ifTrue:
       [self waitForAnyChange].
   e := WebElement new.
  e addText: Time now printString. 
Transcript show: 'live content';cr.
^e

Not as simple to me.  I expect my problem lies in not understanding self session lastRequest isAjaxRequest.

Anyway, I have

MyApp>>waitForAnyChange
| count change |
  count := 1. change := false.
  CustomAnnouncement announcer subscribe: CustomAnnouncement do: [:ann | change := true].
  [change not and: [count < 10]] whileTrue:
     [(Delay forSeconds: 1) wait.
Transcript show: count; cr.
     count := count + 1].
  CustomAnnouncement announcer unsubscribe: CustomAnnouncement.

This "works" in that liveContent runs after count reaches 10 or is interrupted by CustomAnnouncement, but then there is an [Ajax?] delay of an additional 10 seconds (or whatever I send with updateEverySeconds: n) BEFORE my waitForAnyChange loop kicks off again.

How do I get the Ajax cycle to "refresh" so I can immediatly start waitForAnyChange after handling the annoucement, rather than having a full cycle of non-deferred waiting, because at that point you might as well just be using Ajax without trying to "Reverse" it at all...

Thanks,

Rob


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida