1. @JsType
@JsType
public class Person {
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
@JsProperty
public String getName() {
return name;
}
@JsProperty
public int getAge() {
return age;
}
@JsMethod
public void incrementAge() {
age++;
}
}
2. @JsProperty
@JsType
public class Person {
private String name;
@JsProperty
public String getName() {
return name;
}
@JsProperty
public void setName(String name) {
this.name = name;
}
}
3. @JsMethod
@JsType
public class Person {
private int age;
@JsMethod
public void incrementAge() {
age++;
}
}
groovy
dependencies {
implementation 'org.gwtproject:gwt-web-sockets:1.0.0-rc-1'
implementation 'org.gwtproject:gwt-web-sockets-jsinterop:1.0.0-rc-1'
implementation 'org.gwtproject:gwt-elemental:1.2.0'
}