From 55cabc8c6772f8b4c816c43753b1ff63101d52eb Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Sat, 23 Sep 2023 19:28:32 -0500 Subject: [PATCH] fix(VRButton): SSR compat (#293) --- src/webxr/VRButton.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webxr/VRButton.ts b/src/webxr/VRButton.ts index d2936308..1ec7a521 100644 --- a/src/webxr/VRButton.ts +++ b/src/webxr/VRButton.ts @@ -137,7 +137,7 @@ class VRButton { static xrSessionIsGranted = false static registerSessionGrantedListener(): void { - if ('xr' in navigator) { + if (typeof navigator !== 'undefined' && 'xr' in navigator) { ;(navigator as Navigator).xr!.addEventListener('sessiongranted', () => { VRButton.xrSessionIsGranted = true })