gecko-dev/dom/messagechannel/tests/sharedWorker_messageChannel.js

9 строки
183 B
JavaScript

onconnect = function(evt) {
var mc = new MessageChannel();
evt.ports[0].postMessage(42, [mc.port2]);
mc.port1.onmessage = function(e) {
mc.port1.postMessage(e.data);
}
}