Let me explain the new Event management in Aida, which was inspired
mainly by Herbert's Christmas wish , but also on my recent study of
. All three influences talk about browser events (like mouse clicks)
and how to handle them.
Recent trend (as shown by node.js) namelly is to extend the browser's
event loop to the server side. Browser's event loop is also asynchronous
and never blocks, idea therefore is that server side event handling is
also asynchronous and never blocks. With Aida we are now close to that
<a onclick="aidaEvent('click','id6','62667'); "
On server side we have now a greatly expanded freedom to handle such
events in many different ways, like:
(e addNilLinkText: 'Click me')
onClickDo: ["some action"]; "action block, aka callback"
onClickUpdate: someElement; "recreate and update that element"
onClickUpdate: someElement with: someArgument;
onClickPopup: self popup; "lightboxed popup windows"
onClickPopup: self popup thenUpdate: someElement;
onClickClose; "close the popup window"
Also, you can update some web element simply by:
And whatever you like, not just during web request cycle. When some
outside event occurs, like email comes etc. If you browser is WebSocket
enabled, such update will be send immediately to the browser. Always
present Comet therefore!
This 'e update' aproach was influenced by Iliad's #markDirty, thanks
goes to Nicolas Petton for that!
A nice example of very lightweight ajaxified status toggling is included
in Aida, as admin see Security->Sessions->Logged-in or directly:
http://localhost:8888/sessions?view=logged. If you click 'login' in
first column, it will be changed to 'logout' and this session will be
logged out immediately.
To see how simple is now to achive that, here is the code: