Skip to content

Commit

Permalink
Merge pull request #130 from stalgiag/inlineFallback
Browse files Browse the repository at this point in the history
Fix inline mode on Safari
  • Loading branch information
stalgiag authored Jun 10, 2021
2 parents 71d2b92 + f8dddf6 commit eb95032
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/p5xr/core/p5xrButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export default class p5xrButton {
this.options.onEndSession(this.session);
} else if (this.device) {
// feature detect
if (typeof DeviceMotionEvent.requestPermission === 'function') {
if (typeof DeviceMotionEvent !== 'undefined' && typeof DeviceMotionEvent.requestPermission === 'function') {
DeviceMotionEvent.requestPermission()
.then((permissionState) => {
if (permissionState === 'granted') {
Expand All @@ -396,7 +396,7 @@ export default class p5xrButton {
.catch(console.error);
}

if (typeof DeviceOrientationEvent.requestPermission === 'function') {
if (typeof DeviceOrientationEvent !== 'undefined' && typeof DeviceOrientationEvent.requestPermission === 'function') {
DeviceOrientationEvent.requestPermission()
.then(permissionState => {
if (permissionState === 'granted') {
Expand Down

0 comments on commit eb95032

Please sign in to comment.