From 1ffad79320f83038d1fc09e9112c40c86d948416 Mon Sep 17 00:00:00 2001 From: Stefanic <4499284+Stefanic@users.noreply.github.com> Date: Fri, 14 Aug 2020 17:31:03 +0200 Subject: [PATCH] fix(ibeacon): undefined locationManager (#3505) Change some cordova.plugins calls to window.cordova.plugins to prevent 'Cannot read property 'locationManager' of undefined' --- src/@ionic-native/plugins/ibeacon/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/@ionic-native/plugins/ibeacon/index.ts b/src/@ionic-native/plugins/ibeacon/index.ts index b0b0ab7672..3e6cd2a2cd 100644 --- a/src/@ionic-native/plugins/ibeacon/index.ts +++ b/src/@ionic-native/plugins/ibeacon/index.ts @@ -293,7 +293,7 @@ export class IBeacon extends IonicNativePlugin { */ @CordovaCheck({ sync: true }) Delegate(): IBeaconDelegate { - const delegate = new cordova.plugins.locationManager.Delegate(); + const delegate = new window.cordova.plugins.locationManager.Delegate(); delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => { return new Observable((observer: any) => { @@ -358,7 +358,7 @@ export class IBeacon extends IonicNativePlugin { }); }; - cordova.plugins.locationManager.setDelegate(delegate); + window.cordova.plugins.locationManager.setDelegate(delegate); return delegate; } @@ -382,7 +382,7 @@ export class IBeacon extends IonicNativePlugin { minor?: number, notifyEntryStateOnDisplay?: boolean ): BeaconRegion { - return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); + return new window.cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay); } /**