<!DOCTYPE html>
<script>
let logic = new Function('event', (new URL(location)).searchParams.get('logic'));
onload = () => window.portalHost.postMessage('ready');
onportalactivate = event => {
  Promise.resolve(event)
      .then(logic)
      .then(reply => event.data.replyPort.postMessage(reply));
};
</script>
