[Bese-devel] ajax and frames

Attila Lendvai attila.lendvai at gmail.com
Tue May 16 08:58:07 UTC 2006


hi!

i've added two new buttons to the counter example in the ucw_ajax
branch that increments and decrements the counter with ajax. there
were some reports that it's not working correctly on the client side,
though. i'm working with a recent firefox + firebug and it works fine
for me. eventually it'll be tested on other browsers, but feel free to
send patches... :)

i've taken a bit different route then what Evrim did with his ajax
implementation and i hope he won't be angry for me doing this. i'll
merge whatever i can from his patch, but currently mostly the
low-level stuff is being crafted. i'm adding features to <ucw: yaclml
tags, actions, tal tags...

my approach was to smarten up ucw's action handling and it seems to
work fine. if you look at the counter example diff in the ajax branch
you can see how little it takes in the user code to ajaxify something.

you can even choose trivially wether an action should be run in a new
frame with-call/cc or in the same frame without the interptered stuff
(much more lightweight). you make this choice based on wether you want
to use call/answer or not in the action.

for the counter example it means that increment can be a lightweight
ajax action because it never uses call/answer but on the other hand
decrement needs to run in a new frame because it call's a dialog when
going below 0.

the problem is that it generates a new frame for each decrement action.

what i was thinking about is some kind of lazy frame creation: the
request context knows if a new frame has been created or not and when
it's first detected that a new frame is needed then it's lazily
created. but i don't exactly know how to detect that a new frame is
needed... and maybe it can't even work, but maybe this blurred idea
inspires someone... Macro? :)

another problem might be that with ajax actions the rendering is
started from inside the action body and if someone creates a complex
action then rendering may happen before something happens that needs a
new frame. but that can be easily avoided with two separate
collect-invalid/render phase, similar to how render-loop is called
with normal actions.

ideas?

- attila

(alias 101 on irc &no 'its not lisp code :)


More information about the bese-devel mailing list