Andreas Junghans <[EMAIL PROTECTED]> writes:
> Hi Fabian,
>
> Am 26.01.2007 um 08:09 schrieb Fabian Jakobs:
>
>>> var _this = this;
>>>
>>> mycall = rpc.callAsync(function(result, ex, id) {
>>>
>>> if (ex == null)
>>> {
>>> _this.openWindow();
>>>
>> In other places of the framework we define an additional parameter for
>> 'this' if a callback parameter is required. For example
>> "addEventListener" bahaves this way. Wouldn't it make sense to add a
>> 'this' parameter to 'callAsync' as well to be more consistent with the
>> framework and avoid such hacks?
>
> I don't like the idea of cluttering up callAsync with another
> parameter (and I don't consider the use of closures - which is what's
> going on here - a "hack").
I don't have a strong preference. I wouldn't mind adding an additional
parameter for the replacement 'this', but I also don't have any problem with
the closure. I'll let you two fight it out. ;-)
> Besides, there's already the "callAsyncListeners" method which has
> the same purpose as "callAsync" but behaves more "qooxdoo-ish" (using
> the standard listener concept where you can add a listener with a
> specific "this" context).
>
> However, I think the callAsyncListeners method needs some rework (I
> don't know who implemented it - Derrell?). I don't see an easy way to
> find out which server method was called when the result arrives,
> which makes it hard to have concurrent asynchronous calls. I think we
> should pass something like {result: ..., methodName: ..., id: ...} to
> the listeners.
Yes, I implemented it. It's in use in the Samba Web Administration Tool in
samba4, which uses the Finite State Machine to handle all events.
The id is in the result that's passed as data to the listener. In fact, in
the "completed" event handler (Rpc.c:311), we verify that it matches the
sequence number of the request. Is there something other than this id that's
missing? (We've never provided the method name on any async response. I
believe it's up to to the caller to save that information, referenced by the
id, if the caller needs it.)
Cheers,
Derrell
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel