summaryrefslogtreecommitdiffstats
path: root/dom/messagechannel/tests/sharedWorker_messageChannel.js
blob: 874860e99fce17bd6b2982bcda3c57590fafb8f9 (plain)
1
2
3
4
5
6
7
8
9
10
/* eslint-env worker */

onconnect = function (evt) {
  var mc = new MessageChannel();

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