Web-Worker with GWT
What's the simplest way of getting a Web-Worker thread loaded with a GWT module?
I am not referring to getting support for Web-Worker in GWT (there are libraries for that) but rather how would generate a GWT module for loading into a web-worker?
I sus开发者_JAVA百科pect I need a special Linker - is there one available somewhere?
Have a look at http://code.google.com/p/speedtracer/source/browse/trunk/src/client/ui/src/com/google/gwt/webworker/ I didn't dig deep but it seems to be that "special linker" you're looking for (the linker is then used for the "hintlet engine" and "breaky" modules of SpeedTracer)
There is a library called gwt-ns which includes web worker. Following link is the example using it. http://extremelysatisfactorytotalitarianism.com/blog/?p=645
UPDATE The author of gwt-ns posted a note that he stopped development since 2010, so it's not compatible with recent GWT (like 2.6.1 or later)
NOTE (04 February 2014): gwt-ns hasn't been touched since June 2010 and my understanding is that the Web Worker support does not work in any recent versions of GWT. This is somewhat expected, as it had to reach fairly far into the GWT compiler to work and would have had to make changes as the compiler design changed. The other modules are also likely out of date since permutation selection for these features would need to be adjusted as browsers add support or move support from prefixed to full. Some things might still accidentally work. Feel free to use the code as you please, but be forewarned. I no longer do any GWT development, so if you'd like to get workers working again with gwt-ns as a base, you'll need to fork the code and start a new project (luckily the Apache 2.0 license makes this easy for you).
You can try my gwtwwlinker project published on GitHub: https://github.com/tomekziel/gwtwwlinker
It allows you to compile separate module as web worker, dedicated linker eliminates usual $wnd
and $doc
dependencies.
Manfred Tremmel has taken the core code from the Google Speedtest application and put it in a separate repository gwt-webworker. I've added a very simple example code at SimpleWebWorker. This code works with the latest 2.8.1 version of GWT.
精彩评论