Sunday, June 19, 2016

Re: Unable to access exported JsType from JavaScript

Looking at your code, the class would be available at "blah.WebUI", but you'd have to create a new instance before your can call your method, and given how you initialize it you'd have to call onModuleLoad before that.
Maybe if you make your method and all the fields 'static' that'd work; either that or move the initialization in the class constructor (and maybe use another class as the EntryPoint to avoid a double initialization).

On Sunday, June 19, 2016 at 8:37:05 PM UTC+2, Andrea Spadaccini wrote:
Hi everyone,
I am trying to port my CPU simulator from Java to Javascript, and I am using GWT for it. Thanks for the awesome work!

I'd like to just expose a single Java object to JS, and then build the UI using HTML/CSS/<JS framework du jour>. To do so, I think I need to use JsInterop, right?

I am trying to do so, without success.

My code (https://github.com/lupino3/edumips64/blob/jsinterop/src/main/java/org/edumips64/client/WebUi.java) compiles to JS and I can see the code running and producing output in the Chrome console. However, I can't find a way to access the WebUI.runAndGetRegisters() method from the Chrome console. Once that works, I can set up a better interface between JS and Java, but first I'd like to be able to execute one single method.

Given my current use of JsType, under what name should I be able to run the WebUI.runAndGetRegisters() method?

Thanks in advance,
Andrea

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment