I have been having some trouble with a callback for a custom RPC method I 
created for my container.  The method is pretty simple at this point for 
debugging purposes and just returns a static value to the caller.  The RPC 
method is registered and works fine both when the gadget calls to it and when 
the container responds with the results.  The problem I have is if the gadget 
is re-rendered to change the view to canvas or just for a refresh.  I tracked 
the problem into the rpc.js file at the point of the callSameDomain(target, 
rpc) method.

>From what I have found the first time through the callSameDomain method, the 
>sameDomain array does not have an entry for my target (the calling gadget) and 
>wires up the gadgets.rpc.receiveSameDomain method in this line of code:

sameDomain[target] = targetEl.gadgets.rpc.receiveSameDomain;

The code then falls through to check if the sameDomain[target] is now a 
function and then calls the wired up function completing the RPC callback.

The problem comes when I re-render (change to canvas view or refresh the 
gadget) the gadget after a successful RPC callback and make another RPC call in 
that gadget.  The same method is called - callSameDomain(target, rpc).  This 
time around the sameDomain[target] still contains the function reference from 
the initial call and falls through to the call of that function.   That is 
where I receive an error.  From what I can tell, the re-rendering of the 
gadget's iframe dereferences the function and now the rpc calls to that gadget 
are broken until I refresh the entire page.

I don't know if I am missing something silly here, but I am a bit stuck.

Any help would be much appreciated.

Steve T.

Reply via email to