I am trying to create an object in plain java to pass it to a js library directly (as an anonymous object) using a native method, but the library doesn't seem to "see" its fields.
For example, let's say the library has a method that is normally initialized like this:
mylibrary.initializeApp({
appId: "myappid",
name: "test name"}
);
I want to create a native GWT method that has a parameter a class created in java.
For example, I want to create a class named Config (the library does not have a Config class in javascript):
public class Config {
public String appId;
public String name;
}
And a method to initialize the library:
public static native void initializeApp(Config config) /*-{
console.log(config);
$wnd.mylibrary.initializeApp(config);
}-*/;
How can I do this using JS overlay / jsinterop or JSON object utils? (I am trying to create a simple Firebase wrapper for messaging, and I would like to do it as simple as possible)