Skip to content

r3f-xr-widgets / useXRSessionModeSupportedPolling

Function: useXRSessionModeSupportedPolling()

useXRSessionModeSupportedPolling(mode): boolean | undefined

Defined in: src/hooks/useXRSessionModeSupportedPolling.ts:18

Temporary polling-based hook to check if a specific XRSessionMode is supported.

This polls navigator.xr.isSessionSupported() every 100ms until support is detected. Once the React XR PR with devicechange support is merged, this can be replaced with the event-driven implementation from @react-three/xr.

Parameters

mode

XRSessionMode

The XRSessionMode to check ('immersive-vr' | 'immersive-ar' | 'inline')

Returns

boolean | undefined

boolean | undefined - true if supported, false if not, undefined if still checking

Released under the MIT License.