Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
create(options: FlurryAnalyticsOptions): FlurryAnalyticsObject {
let instance: any;
if (
checkAvailability(
FlurryAnalytics.pluginRef,
null,
FlurryAnalytics.pluginName
) === true
) {
instance = new (window as any).FlurryAnalytics(options);
}
return new FlurryAnalyticsObject(instance);
}
}
static computeOffsetOrigin(to: ILatLng, distance: number, heading: number): LatLng {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return GoogleMaps.getPlugin().geometry.spherical.computeOffsetOrigin(to, distance, heading);
}
static encodePath(path: ILatLng[] | BaseArrayClass): string {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return GoogleMaps.getPlugin().geometry.encoding.encodePath(path);
}
static isLocationOnEdge(location: ILatLng, path: ILatLng[]): boolean {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return GoogleMaps.getPlugin().geometry.poly.isLocationOnEdge(location, path);
}
}
switchMap(() => {
/**
* Native HTTP Cordova plugin doesn't like local requests
*/
const isExternalRequest = checkExternalRequest(req);
if (
isExternalRequest &&
checkAvailability('cordova.plugin.http') === true
) {
return this.cordovaHttpBackend.handle(req);
} else {
return this.fallbackBackend.handle(req);
}
}),
);
constructor(title: string, options: LocalNotificationOptions) {
if (
checkAvailability(
PhonegapLocalNotification.pluginRef,
null,
PhonegapLocalNotification.pluginName
) === true
) {
this._objectInstance = new Notification(title, options);
}
}
static getLicenseInfo(): Promise {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return getPromise((resolve) => {
GoogleMaps.getPlugin().environment.getLicenseInfo((text: string) => resolve(text));
});
}
static computeArea(path: ILatLng[] | BaseArrayClass): number {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return GoogleMaps.getPlugin().geometry.spherical.computeLength(path);
}
static computeHeading(from: ILatLng, to: ILatLng): number {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === false) {
throw new Error('cordova-plugin-googlemaps is not ready. Please use platform.ready() before accessing this method.');
}
return GoogleMaps.getPlugin().geometry.spherical.computeHeading(from, to);
}
static create(element: string | HTMLElement | GoogleMapOptions, options?: GoogleMapOptions): GoogleMap {
if (checkAvailability(GoogleMaps.getPluginRef(), null, GoogleMaps.getPluginName()) === true) {
if (element instanceof HTMLElement) {
if (!element.offsetParent) {
throw new Error('Element must be under ');
}
if (element.getAttribute('__pluginMapId')) {
throw new Error(`${element.tagName}[__pluginMapId='${element.getAttribute('__pluginMapId')}'] has already map.`);
}
} else if (typeof element === 'object') {
options = element as GoogleMapOptions;
element = null;
}
const googleMap: GoogleMap = new GoogleMap(element as HTMLElement | string, options);
googleMap.set('_overlays', {});
return googleMap;
} else {
const errorMessage: string[] = [