function HitTest(renderer, hitTestSourceDetails) {
  this.renderer = renderer;
  this.xrHitTestSource = null;
  renderer.xr.addEventListener('sessionend', function () {
    this.xrHitTestSource = null;
  }.bind(this));
  renderer.xr.addEventListener('sessionstart', function () {
    this.sessionStart(hitTestSourceDetails);
  }.bind(this));
  if (this.renderer.xr.isPresenting) {
    this.sessionStart(hitTestSourceDetails);
  }
}
Class to handle hit-test from a single source

For a normal space provide it as a space option
new HitTest(renderer, {
  space: viewerSpace
});

this is also useful for the targetRaySpace of an XRInputSource

It can also describe a transient input source like so:

var profileToSupport = 'generic-touchscreen';
var transientHitTest = new HitTest(renderer, {
  profile: profileToSupport
});

Where the profile matches an item in a type of controller, profiles matching 'generic-touchscreen'
will always be a transient input and as of 08/2021 all transient inputs are 'generic-touchscreen'

@param {WebGLRenderer} renderer THREE.JS Renderer
@param {object} hitTestSourceDetails The source information either as the information for a transient hit-test or a regular hit-test