Hello, this is a vue.js instance running with WebAssembly
Current message : {{welcomemessage}}
And here is my Java code:-)
public class VueDemo {
public interface MyVueInstance extends VueInstance {
@OpaqueProperty
void welcomemessage(String aNewMessage);
}
private static VueEventListener<MyVueInstance, ClickEvent> listener;
public static void main(final String[] args) {
// We need the static reference to avoid garbage collection for this object
// Opaque References are NOT visible to the GC, hence all references it holds also!!!
listener = new VueEventListener<MyVueInstance, ClickEvent>() {
@Override
public void handle(final MyVueInstance instance, final ClickEvent event) {
instance.welcomemessage(String.format("hello world, you have clicked. Timestamp is %s", System.currentTimeMillis()));
}
};
final VueBuilder<MyVueInstance> theBuilder = Vue.builder();
theBuilder.bindToTemplateSelector("#vuetemplate");
theBuilder.data().setProperty("welcomemessage", "hello world!");
theBuilder.addEventListener("clicked", listener);
MyVueInstance instance = theBuilder.build();
}
}