The JsInterop part worked now - in the end it was the missing 
-generateJsInteropExports and my confusion when to use $wnd and when not.

On Tuesday, 11 April 2017 17:30:39 UTC+2, Thomas Broyer wrote:
>
>
>
> On Tuesday, April 11, 2017 at 4:53:24 PM UTC+2, Philipp Gloor wrote:
>>
>> Where do I use $wnd.test.JsOpClass()? It doesn't work within <script> 
>> tags inside the HMTL file of my GWT project.
>>
>
> $wnd (and $doc) is specific to JSNI. Outside JSNI, in "pure JS", should be 
> able to use "new test.jsOpClass()", *after* the GWT app has been 
> loaded/started (onModuleLoad).
>  
>
>> The reason I'm looking at JsInterop was because we want to use web 
>> workers. And since there is no GWT implementation of web workers I would do 
>> this via native calls. And the web worker would only forward methods 
>> because once I'm in the worker thread I have to call GWT functions again.
>>
>> GWT Mainthread --->   Worker.js  ---> GWT in a worker thread
>>
>> The calls from Worker.js to GWT in the worker thread would also pass an 
>> instance of the worker itself into GWT (as JavaScriptObject) so I could 
>> call worker.postMessage to get back to the main thread.
>>
>
> A worker is another browsing context as far as browsers are concerns, so 
> you cannot use GWT to write the worker code from within the application 
> code; those would have to be 2 distinct GWT applications.
> You can write web worker code with GWT if you use a specific linker that 
> doesn't depend on the DOM. You could try to use the "sso" linker 
> (<add-linker name="sso"/>) maybe, or look for some existing third-party 
> linker for web workers.
>
> Using JsInterop, you could then easily share Java code for the objects 
> that you pass back and forth between the app and the worker.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to