public void init() {
connector.addStateChangeHandler(new StateChangeHandler() {
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
JavaScriptObject wrapper = getConnectorWrapper();
JavaScriptConnectorState state = getConnectorState();
for (String callback : state.getCallbackNames()) {
ensureCallback(JavaScriptConnectorHelper.this, wrapper,
callback);
}
for (Entry<String, Set<String>> entry : state
.getRpcInterfaces().entrySet()) {
String rpcName = entry.getKey();
String jsName = getJsInterfaceName(rpcName);
if (!rpcObjects.containsKey(jsName)) {
Set<String> methods = entry.getValue();
rpcObjects.put(jsName,
createRpcObject(rpcName, methods));
// Init all methods for wildcard rpc
for (String method : methods) {
JavaScriptObject wildcardRpcObject = rpcObjects
.get("");
Set<String> interfaces = rpcMethods.get(method);
if (interfaces == null) {
interfaces = new HashSet<String>();
rpcMethods.put(method, interfaces);