How to use the @ionic-native/core.checkAvailability function in @ionic-native/core

To help you get started, we’ve selected a few @ionic-native/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / ionic-native / src / @ionic-native / plugins / flurry-analytics / index.ts View on Github external
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);
  }
}
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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);
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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);
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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);
  }
}
github sneas / ionic-native-http-connection-backend / src / native-http-fallback.ts View on Github external
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);
                }
            }),
        );
github ionic-team / ionic-native / src / @ionic-native / plugins / phonegap-local-notification / index.ts View on Github external
constructor(title: string, options: LocalNotificationOptions) {
    if (
      checkAvailability(
        PhonegapLocalNotification.pluginRef,
        null,
        PhonegapLocalNotification.pluginName
      ) === true
    ) {
      this._objectInstance = new Notification(title, options);
    }
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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));
    });
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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);
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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);
  }
github ionic-team / ionic-native-google-maps / src / @ionic-native / plugins / google-maps / index.ts View on Github external
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[] = [