Thursday, November 5, 2020

Re: Is it possible to implement a web worker with GWT?

Hi,

I'm not sure, will this project helps you: https://gitlab.com/ManfredTremmel/gwt-webworker?

I really want to use it, but can't figure out the docs.

In the GWT side, it says to use:

Worker worker = Worker.create(<javascriptname>) 
...
worker.postMessage("(may be serialized) data to handle in web worker"); 

What is the javascriptname?

If MyWebWorker.gwt.xml renames my webwork module to "mywebworker.wkr", do I use something like:

Worker.create("/mywebworker.wkr/mywebworker.wkr.nocache.js");

Other examples online seem to suggest so, but mywebworker.wkr.nocache.js isn't being generated in compilation so am stuck on what to do.

Anyone?

Shawn



t.br...@gmail.com schrieb am Freitag, 2. Oktober 2020 um 17:04:55 UTC+2:
It is, through a linker: http://www.gwtproject.org/doc/latest/DevGuideLinkers.html
It might work with the D8ScriptLinker shipped in GWT (https://github.com/gwtproject/gwt/blob/2.9.0/dev/core/src/com/google/gwt/core/linker/D8ScriptLinker.java); you'll have to declare it in a *.gwt.xml though (define-linker then add-linker).
Or there might be (IIRC, there are) libraries with such a linker specifically for workers.


On Thursday, October 1, 2020 at 10:43:37 PM UTC+2, Bruno Salmon wrote:
hi,

I have a GWT web app that I would like to make more reactive by moving some heavy computation code into web workers. This code doesn't need the context of the application to run, I just need to pass it a few input parameters so it should be a good fit for a web worker.

I see how the web app can instantiate web workers using elemental2.dom.Worker.

But as my worker code is in Java, I would like to know if I can use the GWT compiler to generate the worker itself. I expect a js file with a onmessage function as output that I can load from the web app.

Is it possible to do this?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/0498c25c-1bd1-471c-aaa7-c9bba70488ecn%40googlegroups.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAM5TeUzCA77y1yFAoqijPFOLnaVMdKPOcUG782AcWhPLi-S-zg%40mail.gmail.com.

No comments:

Post a Comment