tor-browser

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

shared-worker.js (366B)


      1 // This is loaded as a SharedWorker in a WPT. When postMessaged to, forwards
      2 // that message to all registered ports through a postMessage call.
      3 const ports = [];
      4 
      5 onconnect = function (event) {
      6  const port = event.ports[0];
      7  ports.push(port);
      8 
      9  port.onmessage = async function(e) {
     10    ports.forEach(curPort => {
     11      curPort.postMessage(e.data);
     12    });
     13  }
     14 }