On Thu, May 7, 2009 at 7:47 AM, Andreas G. <[email protected]> wrote:
>
> im testing callAsyncListeners now.
>
> here's the code:
>
> rpcListenerTest: function()
> {
> var rpc = new qxgui.utils.Rpc;
>
> rpc.callAsync( "getMenuXml" );
> rpc.addListener( "completed", function(e)
> {
> var xml = new qxgui.utils.XML();
>
> xml.setDocument( e.getData() );
> alert( xml.isXmlDocument() ); // false
>
> qxgui.utils.Vars.dump( e.getData() ); // object
> });
> }
>
> to avoid questions about rpc.callAsync heres the code of the method:
>
> callAsync: function( method, args )
> {
> this.__rpc.callAsyncListeners( true, method, args );
> }
>
> now to my question. the api says that i get a JSON-RPC result on success,
> is
> it different than the result of the callback-function in callAsync(...) ?
>
Nope, it's exactly the same result. It's just provided to you via an event
listener rather than via a callback function.
BTW, you should add your listener BEFORE issuing the async call. Although
Javascript single-threading should prevent the problem, there is a (very)
slight chance that the response could be returned before your listener gets
established, and with no listener, the response would just be thrown away.
Therefore do your rpc.addListener("completed", ...) call before calling
rpc.callAsync("getMenuXml").
Derrell
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel