Revision d74cfc00f15092d6491b01b27616520d5beb5c13 authored by Domenic Denicola on 02 April 2018, 18:58:09 UTC, committed by Domenic Denicola on 02 April 2018, 18:58:09 UTC
See https://github.com/w3c/web-platform-tests/pull/9869#issuecomment-378002725.
1 parent af485dc
Raw File
PresentationConnection_terminate_receiving-ua.html
<!DOCTYPE html>

<meta charset="utf-8">
<title>Terminating a presentation in a receiving browsing context</title>
<link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs/">
<link rel="help" href="https://w3c.github.io/presentation-api/#terminating-a-presentation-in-a-receiving-browsing-context">
<script src="../common.js"></script>
<script src="stash.js"></script>

<script>
  const stash = new Stash(stashIds.toReceiver, stashIds.toController);

  navigator.presentation.receiver.connectionList.then(list => {
    const connection = list.connections[0];

    // terminate a presentation when two presentation connections become "connected"
    list.onconnectionavailable = evt => {
      connection.terminate();

      stash.sendBeacon({ type: (window.closed ? 'ok' : 'error') });
    };
  });
</script>
back to top