tor-browser

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

PresentationConnection_terminate_receiving-ua.html (833B)


      1 <!DOCTYPE html>
      2 
      3 <meta charset="utf-8">
      4 <title>Terminating a presentation in a receiving browsing context</title>
      5 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs/">
      6 <link rel="help" href="https://w3c.github.io/presentation-api/#terminating-a-presentation-in-a-receiving-browsing-context">
      7 <script src="../common.js"></script>
      8 <script src="stash.js"></script>
      9 
     10 <script>
     11  const stash = new Stash(stashIds.toReceiver, stashIds.toController);
     12 
     13  navigator.presentation.receiver.connectionList.then(list => {
     14    const connection = list.connections[0];
     15 
     16    // terminate a presentation when two presentation connections become "connected"
     17    list.onconnectionavailable = evt => {
     18      connection.terminate();
     19 
     20      stash.sendBeacon({ type: (window.closed ? 'ok' : 'error') });
     21    };
     22  });
     23 </script>