JavaScript callback function and ServerRpc

I have JavaScript with a named event function that has a callback function as a parameter: onUpdate(object, callback)

I’ve been able to pass this callback function as an Object back to the ServerRpc method but it doesn’t appear to be a String so I can’t use callFunction(callback, object) which is what I need to do. I tried to pass it back as JavaScriptFunction but it just gives an Internal Error (but doesn’t log any information about it).

In the browser console “rpc” request the callback appears as an empty set of braces {}.

I tried to assign it to object.callback and then use callFunction(object.callback, object) but I get this error:

[17:21:57.031]
"Wed Oct 08 17:21:57 GMT-400 2014 com.vaadin.client.VConsole
SEVERE: (TypeError) : a[b]
is undefinedcom.google.gwt.core.client.JavaScriptException: (TypeError) : a[b]
is undefined
"

I tried to make the function global by assigning it to a window object var and passing the var name to the server and callFunction on that but get:

[17:29:38.051]
"Wed Oct 08 17:29:38 GMT-400 2014 com.vaadin.client.VConsole
SEVERE: (TypeError) : mB(…).re(…) is nullcom.google.gwt.core.client.JavaScriptException: (TypeError) : mB(…).re(…) is null
"

Is this something Vaadin is capable of? Does anyone know how to go about it?

If add a javascript function to a state variable and check it with typeof in the connector it says it’s a string and I cannot call it. Is it not possible to pass a function in an JavaScriptComponentState variable? Is there some way to encode it so it works?