I believe you can check the origin of the onmessage event to see if it was the worker. But I'm not familiar enough with the DOM to know.
On Tue, Mar 1, 2016 at 12:00 PM, Robert Goulet <[email protected]> wrote: > Ok but if I add a listener on the window for the "message" event, isn't > that a bit opening the door for other sites to send stuff? It would > probably be cleaner to add the event listener on the workers, but I don't > know if I have access to that from my shell.html file ... ? > > On Tuesday, March 1, 2016 at 1:38:04 PM UTC-5, Alon Zakai wrote: >> >> You can call console.log in the worker if you want to just print. >> Otherwise, you can postMessage to the main thread, and add a listener >> there, and call alert() for that specific message type. >> >> On Tue, Mar 1, 2016 at 8:34 AM, Robert Goulet <[email protected]> >> wrote: >> >>> Ok I just learned that we don't have access to DOM in workers, so I >>> can't call alert. How can I redirect the alert call to the main thread? >>> >>> >>> On Monday, February 29, 2016 at 3:35:36 PM UTC-5, Robert Goulet wrote: >>>> >>>> When calling 'alert' function outside of main thread, I get this error >>>> in FF Nightly: >>>> >>>> pthread sent an error! ReferenceError: alert is not defined >>>> >>>> Is that expected? >>>> >>>> Thanks >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
