Created
November 7, 2010 12:51
-
-
Save fillano/666107 to your computer and use it in GitHub Desktop.
detect DedicatedWorker global scope and report to js in html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onmessage = function(global) { | |
return function(e) { | |
if(e.data.indexOf('start') > -1) { | |
var str = '<table width="100%" border="1" cellspacing="0" cellpadding="2">\n'; | |
for (var i in global) { | |
if(i!=='onmessage') { | |
str += '<tr><td style="background: #AABBCC">' + i + '</td><td style="background: #DDEEFF">' + global[i] + '</td></tr>\n'; | |
} else { | |
str += '<tr><td style="background: #AABBCC">' + i + '</td><td style="background: #DDEEFF">onmessage eventHandler</td></tr>\n'; | |
} | |
} | |
str += '</table>\n'; | |
global.postMessage(str); | |
} | |
}; | |
}(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment