Get window size

Hello again! Today while i was making tests, i was wondering if its possible to get the window size of the browser. Is there any way? all methods are outdated and I found a event(UI.getCurrent().getPage().addBrowserWindowResizeListener(e->{});) that its called every time i resize the browser but this event not works when i launch the aplication.

Thank you again!

Will be available in Vaadin 14 (already testable with Flow 2.0.0.beta1): https://github.com/vaadin/flow/issues/4320

Olli Tietäväinen:
Will be available in Vaadin 14 (already testable with Flow 2.0.0.beta1): https://github.com/vaadin/flow/issues/4320

Ok! thank you!

In agreement! there is a way, with this tutorial [https://vaadin.com/tutorials/calling-java-from-javascript]
(https://vaadin.com/tutorials/calling-java-from-javascript), I could call a javascript function which calls a java function but passing the window.innerWidth as an argument, something like this:

.java

getElement().executeJavaScript("javascriptFunction($0)", getElement());

@ClientCallable
    private void javaFunction(int width){
    	System.out.println(width)
    }

.js

function javascriptFunction(element) {
    element.$server.javaFunction(window.innerWidth);
}

Just following up with syntax for doing this in vaadin 14 in case anyone else stumbles on this:

        UI.getCurrent().getPage().retrieveExtendedClientDetails(details -> { 
            windowWidth = details.getWindowInnerWidth();
            });
        UI.getCurrent().getPage().addBrowserWindowResizeListener(event -> {
            windowWidth = event.getWidth();
        });