11.5. Handling objects from JavaScript

Our last example didn’t create anything while in the JSNI call, that is, no JavaScript objects, for example, but we did say the first parameter passed in was a JavaScript-Object, and now is the time to explore that further.

A JavaScriptObject is a Java object representing an object that’s been created in JavaScript. For example, the GWT Java Element object represents a DOM element created in JavaScript deep in the bowels of GWT when it creates a widget. We can’t create a JavaScriptObject object ourselves in Java code, that is, no new JavaScript-Object() calls; it can only be created automatically as the JavaScript object passes across the boundary from JavaScript to Java.

You can use JavaScriptObject ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.