Explorar o código

make sure event type exists

Raanan Weber %!s(int64=5) %!d(string=hai) anos
pai
achega
55ab068ab4
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

+ 2 - 2
src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

@@ -75,7 +75,7 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
                 }, timeout);
             }
 
-            if (typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
+            if (typeof(DeviceOrientationEvent) !== "undefined" && typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
                 (<any>DeviceOrientationEvent).requestPermission()
                     .then((response: string) => {
                         if (response == 'granted') {
@@ -143,7 +143,7 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
                 //So this is needed.
                 this._orientationChanged();
             };
-            if (typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
+            if (typeof(DeviceOrientationEvent) !== "undefined" && typeof (<any>DeviceOrientationEvent).requestPermission === 'function') {
                 (<any>DeviceOrientationEvent).requestPermission()
                     .then((response: string) => {
                         if (response === 'granted') {