On 24.05.2010 21:34, Thomas Bruederli wrote:
> This is the way we suggest to implement ajax conversation with the server:
> http://trac.roundcube.net/wiki/Doc_Plugins#Ajaxrequestsandcallbacks
>
> In class rcube_json_output all commands starting with "plugin." will be
> added to the response.callbacks list. The reason for this was to force that
> all these callbacks have only one single parameter in order to make things
> easier. This is not given with the internal commands which end up in the
> response.exec list and which needs to be eval'ed on the client. The latter
> one is legacy code and is subject to be changed once in favor of the
> response.callbacks mechanism.
I've missed that, but... I didn't found that someone is using this feature.
>> or, even better, two calls responsebefore* and responseafter*.
> I currently don't see a concrete use-case for these before* and after*
> events. And why do we need two of them ('responseafter' and
> 'responseafter'+response.action)?
In this way I can execute code on response to every or just to selected
action. This is not possible to bind to response of core actions using
response.callbacks. In my solution you've got also an access to response
object. I can imagine a plugin for measuring performance of response
parsing/execution, in this case I could create handlers for
'responsebefore' (timer start) and 'responseafter' (printing time in
console). Other case, let's say I want to do something after creating a
folder, in this case I can bind to 'responseafter' event and check
response.action or bind to 'responseaftercreate-folder'. Because I've
access to response object I could parse it to know if operation was
successful. I think these events are handling all possible usecases for
plugin writers.
--
Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252
LAN Management System Developer http://lms.org.pl
Roundcube Webmail Developer http://roundcube.net
_______________________________________________
List info: http://lists.roundcube.net/dev/