mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 08:32:52 +08:00
fix(ibeacon): undefined locationManager (#3505)
Change some cordova.plugins calls to window.cordova.plugins to prevent 'Cannot read property 'locationManager' of undefined'
This commit is contained in:
parent
44f86f3ce5
commit
1ffad79320
@ -293,7 +293,7 @@ export class IBeacon extends IonicNativePlugin {
|
|||||||
*/
|
*/
|
||||||
@CordovaCheck({ sync: true })
|
@CordovaCheck({ sync: true })
|
||||||
Delegate(): IBeaconDelegate {
|
Delegate(): IBeaconDelegate {
|
||||||
const delegate = new cordova.plugins.locationManager.Delegate();
|
const delegate = new window.cordova.plugins.locationManager.Delegate();
|
||||||
|
|
||||||
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
|
delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => {
|
||||||
return new Observable<IBeaconPluginResult>((observer: any) => {
|
return new Observable<IBeaconPluginResult>((observer: any) => {
|
||||||
@ -358,7 +358,7 @@ export class IBeacon extends IonicNativePlugin {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
cordova.plugins.locationManager.setDelegate(delegate);
|
window.cordova.plugins.locationManager.setDelegate(delegate);
|
||||||
return delegate;
|
return delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ export class IBeacon extends IonicNativePlugin {
|
|||||||
minor?: number,
|
minor?: number,
|
||||||
notifyEntryStateOnDisplay?: boolean
|
notifyEntryStateOnDisplay?: boolean
|
||||||
): BeaconRegion {
|
): BeaconRegion {
|
||||||
return new cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
return new window.cordova.plugins.locationManager.BeaconRegion(identifer, uuid, major, minor, notifyEntryStateOnDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user