code: protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) {
          Object returnObject = invokeJavascript(function);
          if (returnObject instanceof JSObject) {
              try {
                  Constructor<T> constructor = returnType.getConstructor(JSObject.class);
                  return constructor.newInstance((JSObject) returnObject);
              } catch (Exception ex) {
                  throw new IllegalStateException(ex);
              }
          } else {
              return (T) returnObject;
          }
      }
docs: Invokes a JavaScript function that takes no arguments.
  
  @param <T>
  @param function The function to invoke
  @param returnType The type of object to return
  @return The result of the function.