12 Apr 15:41
Squeak and Reverse Ajax
From: Rob Rothwell <r.j.rothwell <at> gmail.com>
Subject: Squeak and Reverse Ajax
Newsgroups: gmane.comp.web.server.aida
Date: 2008-04-12 13:44:26 GMT
Subject: Squeak and Reverse Ajax
Newsgroups: gmane.comp.web.server.aida
Date: 2008-04-12 13:44:26 GMT
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
<div> <p>I think this is more of a Squeak Process question than an Aida question, but I'm not sure.</p> <div><br class="webkit-block-placeholder"></div> <div>I am still trying to "Reverse Ajax" an application using Squeak and Aida.</div> <div><br class="webkit-block-placeholder"></div> <div>Trust that I have a CustomAnnouncement that works.</div> <div><br class="webkit-block-placeholder"></div> <div>I have an application, MyApp, with a 10 second Ajax resolution and a 1 second event resolution as follows: </div> <div><br class="webkit-block-placeholder"></div> <div>MyApp>>viewMain</div> <div> <div> <span class="Apple-tab-span"> </span>|e|</div> <div> <span class="Apple-tab-span"> </span>e:=WebElement new.</div> <div> e add: (self liveContent updateEverySeconds: 10).<br> </div> <div> <span class="Apple-tab-span"> </span>self pageFrameWith: e title: 'My Application'.</div> <div><br class="webkit-block-placeholder"></div> <div>simple enough. "Every 10 seconds do something."</div> <div><br class="webkit-block-placeholder"></div> <div>Where, just to see something happening I have</div> <div><br class="webkit-block-placeholder"></div> <div>MyApp>>liveContent</div> <div> <div> <span class="Apple-tab-span"> </span>|e|<span class="Apple-tab-span"> </span><br> </div> <div> <span class="Apple-tab-span"> </span>self session lastRequest isAjaxRequest ifTrue:</div> <div> <span class="Apple-tab-span"> </span>[self waitForAnyChange].</div> <div> <span class="Apple-tab-span"> </span>e := WebElement new.</div> <div> <span class="Apple-tab-span"> </span>e addText: Time now printString. <span class="Apple-tab-span"></span> </div> <div> <span class="Apple-tab-span"> </span>Transcript show: 'live content';cr.</div> <div> <span class="Apple-tab-span"> </span>^e</div> <div><br class="webkit-block-placeholder"></div> <div>Not as simple to me. I expect my problem lies in not understanding self session lastRequest isAjaxRequest.</div> <div><br class="webkit-block-placeholder"></div> <div>Anyway, I have</div> <div><br class="webkit-block-placeholder"></div> <div> <div>MyApp>>waitForAnyChange</div> <div> <span class="Apple-tab-span"> </span>| count change |</div> <div> <span class="Apple-tab-span"> </span>count := 1. change := false.</div> <div> <span class="Apple-tab-span"> </span>CustomAnnouncement announcer subscribe: CustomAnnouncement do: [:ann | change := true].</div> <div> <span class="Apple-tab-span"> </span>[change not and: [count < 10]] whileTrue:</div> <div> <span class="Apple-tab-span"> </span>[(Delay forSeconds: 1) wait.</div> <div> <span class="Apple-tab-span"> </span>Transcript show: count; cr.</div> <div> <span class="Apple-tab-span"> </span>count := count + 1].</div> <div> <span class="Apple-tab-span"> </span>CustomAnnouncement announcer unsubscribe: CustomAnnouncement.</div> <div><br class="webkit-block-placeholder"></div> </div> <div>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.</div> <div><br></div> <div>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...</div> <div><br></div> <div>Thanks,</div> <div><br class="webkit-block-placeholder"></div> <div>Rob</div> <div><br class="webkit-block-placeholder"></div> </div> </div> </div>
RSS Feed