GWT Web Workers - multiple modules on same page

160 views
Skip to first unread message

Derek

unread,
Jun 15, 2012, 12:08:20 PM6/15/12
to google-we...@googlegroups.com
I am trying to use GWT Web Workers (code based on the speedtracer Web Worker implementation), but I am not able to make the worker module participate in dev mode, requiring me to recompile the worker every time I change code in it. Has anyone else worked on this code and dealt with this problem?

When I create a separate module for my web worker and try to run my code, I get the error "alert is not defined" because the permutation is not created and the worker is trying to run alert("Module 'myworker' may need to be (re)compiled"), which fails since workers don't have access to window.alert.

If I compile the worker module, I get a permutation created which is served up correctly when my main module tries to load the worker at ../myworker/myworker.nocache.js. No errors, everything seems to work correctly, but the myworker module is not participating in dev mode despite my main module participating. So I can modify the code that calls the workers in dev mode, but any changes to the workers requires a recompile of the worker module.

Is there a way to make the worker work with the code server? The Worker linker is based on a SelectionScriptLinker, but I'm not sure if it's the linker that's refusing to generate a dev mode permutation, or the code server, or dev mode, or what.

Has anyone dealt with this problem? Does anyone have any ideas?

Thanks,
Derek

Thomas Broyer

unread,
Jun 16, 2012, 4:49:33 AM6/16/12
to google-we...@googlegroups.com


On Friday, June 15, 2012 6:08:20 PM UTC+2, Derek wrote:
I am trying to use GWT Web Workers (code based on the speedtracer Web Worker implementation), but I am not able to make the worker module participate in dev mode, requiring me to recompile the worker every time I change code in it. Has anyone else worked on this code and dealt with this problem?

I believe this is why SuperDevMode was created in the first place (and also for mobile development).
Web Workers cannot run plugins, so they cannot run your code in DevMode.
I'm not sure how you'd use SuperDevMode with Web Workers though.
Reply all
Reply to author
Forward
0 new messages