blob: 55188fe913c5a18bf3fb1355cc1e535977788a9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
onmessage = function(evt)
{
if (evt.data == "ping")
postMessage("pong");
else if (evt.data == "freeze")
while (1) {}
else if (evt.data == "close")
close();
else if (/eval.+/.test(evt.data)) {
try {
postMessage(evt.data.substr(5) + ": " + eval(evt.data.substr(5)));
} catch (ex) {
postMessage(evt.data.substr(5) + ": " + ex);
}
}
}
|