FWIW, I've usually looked at self.postMessage when trying to determine whether running in dedicated or shared worker context, although Anne's suggestion (using "in") is better.<div><div><div><br></div><div>
-atw<br><br><div class="gmail_quote">On Mon, Oct 26, 2009 at 7:00 AM, Anne van Kesteren <span dir="ltr"><<a href="mailto:annevk@opera.com">annevk@opera.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Mon, 26 Oct 2009 13:57:10 +0100, Simon Pieters <<a href="mailto:simonp@opera.com" target="_blank">simonp@opera.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Web Workers has the following in some example (twice):<br>
<br>
// support being used as a shared worker as well as a dedicated worker<br>
if (this.onmessage) // dedicated worker<br>
....<br>
<br>
This ought to be doing something like (typeof this.onmessage != 'undefined') , as the event property is presumably 'null' by the time of the test.<br>
</blockquote>
<br></div></div>
("onmessage" in this) might be somewhat safer fwiw.<br><font color="#888888">
<br>
<br>
-- <br>
Anne van Kesteren<br>
<a href="http://annevankesteren.nl/" target="_blank">http://annevankesteren.nl/</a><br>
</font></blockquote></div><br></div></div></div>