Skip to content

Conversation

@chrisfromwork
Copy link
Contributor

This review is related to: BabylonJS/BabylonNative#650

In 650, we move the nativeXrContext to be available off the global navigator.xr object. We no longer need to pass in the xr session for initialization/obtaining the xr context.

jsiRuntime.global().getProperty(jsiRuntime, "navigator").asObject(jsiRuntime).hasProperty(jsiRuntime, "xr"))
{
return false;
auto nativeXr = jsiRuntime.global().getProperty(jsiRuntime, "navigator").asObject(jsiRuntime).getProperty(jsiRuntime, "xr").asObject(jsiRuntime);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we didn't have to duplicate this quite so much. Like maybe if the pattern here was more like:

if (!jsiRuntime.global().hasProperty(jsiRuntime, "navigator")
{
    return false;
}

auto navigator{jsiRuntime.global().getProperty(jsiRuntime, "navigator").asObject(jsiRuntime)};
if (!navigator.hasProperty(jsiRuntime, "xr"))
{
    return false;
}

auto nativeXr{navigator.getProperty(jsiRuntime, "xr").asObject(jsiRuntime)};
...

@chrisfromwork chrisfromwork merged commit 216039b into BabylonJS:master Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants