XRButton({
          onRequestSession: onRequestSession,
          onEndSession: onEndSession
        });
        document.querySelector('header').appendChild(xrButton.domElement);

        if (navigator.xr) {
          navigator.xr.isSessionSupported('immersive-vr').then((supported) => {
            xrButton.enabled = supported;
          });
        }
      }

      function onRequestSession() {
        useLayer = useLayerCheckbox.checked;
        return navigator.xr.requestSession('immersive-vr', {
     