tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

chromeWorker_messageChannel.js (420B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 onmessage = function (pingEvt) {
      5  if (pingEvt.data == "ping") {
      6    let { port1, port2 } = new MessageChannel();
      7    port2.onmessage = helloEvt => {
      8      if (helloEvt.data == "hello") {
      9        helloEvt.ports[0].postMessage("goodbye");
     10      }
     11    };
     12    pingEvt.ports[0].postMessage("pong", [port1]);
     13  }
     14 };