Skip to content

Commit

Permalink
inject emulator even if isSessionSupported throws an error
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Nov 15, 2024
1 parent 72d7caa commit 7983223
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/xr/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,16 @@ function injectEmulator(store: StoreApi<XRState<any>>, emulate: EmulatorOptions
if (typeof navigator === 'undefined') {
return
}
Promise.all([navigator.xr?.isSessionSupported('immersive-vr'), navigator.xr?.isSessionSupported('immersive-ar')])
Promise.all([
navigator.xr?.isSessionSupported('immersive-vr').catch((e) => {
console.error(e)
return false
}),
navigator.xr?.isSessionSupported('immersive-ar').catch((e) => {
console.error(e)
return false
}),
])
.then(([vr, ar]) => (!ar && !vr ? import('./emulate.js') : undefined))
.then((pkg) => {
if (pkg == null) {
Expand Down

0 comments on commit 7983223

Please sign in to comment.