How to send data back to the server side?

It’s code from docs:

 public static void logElementSize(String name, Element element) {
        Page page = UI.getCurrent().getPage();

                "console.log($0 + ' size:', $1.offsetWidth, $1.offsetHeight)", name, element);

Note The script is executed asynchronously, so you can’t directly pass values back to the server.

How to send this results back to server side?

Have a look at the replies to my question [here]

Gilberto Torrezan Filho:
Hi Bastian,

You export a method in Java using @ClientCallable, for example:

private void myFunction(){
    //do something on the server-side

… and then call it on the client side by using the $server object:


The name of the function exported on the client-side is the same name of the method declared on the server side.