Currently, it is possible to detect if the platform supports Plane Detection by checking the availability of XRPlane in window.
Once the session has started, and the first XRFrame is provided by XRSession, the only way to check if plane-detection feature is available, is to attempt to get detectedPlanes from XRFrame, and try/catch to identify if it is available.
Most other APIs have a better way to detect availability and do not follow try/catch pattern.
It would be more graceful if detectedPlanes would equal null if the feature is not available, instead of throwing an exception when checking the value of it. Especially while it is not a function, but a property.
Current approach (by the spec):
let planes;
try {
planes = frame.detectedPlanes;
} catch(ex) {
return;
}
Proposed approach:
const planes = frame.detectedPlanes;
if (planes === null)
return;