repo: janusweb action: commit revision: path_from: revision_from: d318d44675c0b406478ade6e2894f76bb5e89bd0: path_to: revision_to:
commit d318d44675c0b406478ade6e2894f76bb5e89bd0 Author: James BaicoianuDate: Tue Jul 13 16:19:34 2021 -0700 Check for navigator.xr before setting up sessiongranted event diff --git a/scripts/client.js b/scripts/client.js
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -104,9 +104,11 @@ elation.require(['engine.engine', 'engine.assets', 'engine.things.light_ambient'
this.enginecfg.picking = true;
this.enginecfg.useWebVRPolyfill = elation.utils.any(this.args.useWebVRPolyfill, true);
- navigator.xr.addEventListener('sessiongranted', (ev) => {
- this.startXR();
- });
+ if ('xr' in navigator) {
+ navigator.xr.addEventListener('sessiongranted', (ev) => {
+ this.startXR();
+ });
+ }
}
this.initButtons = function() {
this.sharebutton = elation.ui.button({classname: 'janusweb_sharing', label: 'Share'});
-----END OF PAGE-----