Q:

How do I do bi-directional communications using "Codename One New-Java-Javascript-Interop-API" in my specific use-case?

I have an App that makes intensive use of "browserComponent" and bidirectional communication between Java native code and Javascript embedded inside web-page content.
Now we must make the same thing using the New Async-Java-Javascript-Interop-API recently posted by Codename One.
In this context, We need to bind all buttons present on each page to routines coded in native code (java/kotlin) as soon the page is loaded.
How can we capture "Html Body on-load-event" and how to activate all binds that we need?
And, on the opposite direction, the java code that was triggered by html-buttons mentioned before, interacts with the users. As a result of these interactions, normally it is necessary to modify some values of javascript variables (frequently a javascript-array) and that way allowing update dynamically the document model in the Browser.
Any help on this subject will be very appreciated.

A:

You can bind an onLoad event in the same way you always could using:
browserComponent.addWebEventListener(BrowserComponent.onLoad, e -> {
    // here you can start writing JS binding code
});

For reference this article covers everything else about the binding https://www.codenameone.com/blog/new-async-java-javascript-interop-api.html

