mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
85611a7b6d
--HG-- extra : rebase_source : a22344ee1569f58f1f0a01017bfe0d46a6a14602
19 lines
486 B
JavaScript
19 lines
486 B
JavaScript
onmessage = function(evt) {
|
|
if (evt.data != 0) {
|
|
var worker = new Worker("broadcastchannel_worker.js");
|
|
worker.onmessage = function(evt) {
|
|
postMessage(evt.data);
|
|
}
|
|
worker.postMessage(evt.data - 1);
|
|
return;
|
|
}
|
|
|
|
var bc = new BroadcastChannel('foobar');
|
|
bc.addEventListener('message', function(event) {
|
|
bc.postMessage(event.data == "hello world from the window" ? "hello world from the worker" : "KO");
|
|
bc.close();
|
|
});
|
|
|
|
postMessage("READY");
|
|
}
|