How to use the @capacitor/core.Capacitor.platform function in @capacitor/core

To help you get started, we’ve selected a few @capacitor/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 abritopach / angular-ionic-ngxs-movies / src / app / pages / detail / detail.ts View on Github external
.subscribe(result => {
      if (result.items.length > 0) {
        console.log(result);
        const { videoId } = result.items[0].id;
        this.movie.videoId = videoId;

        // Code to use capacitor-youtube-player plugin.
        console.log('DetailsPage::watchTrailer -> platform: ' + Capacitor.platform);
        if (Capacitor.platform === 'web') {
          const componentProps = { modalProps: { item: this.movie}};
          this.presentModal(componentProps, YoutubeModalComponent);
        } else { // Native
          this.testYoutubePlayerPlugin();
        }

        /*
        if (Capacitor.platform === 'web') {
          window.open('https://www.youtube.com/watch?v=' + videoId);
        } else { // TODO: Use capacitor-youtube-player plugin.
          window.open('https://www.youtube.com/watch?v=' + videoId, '_blank');
        }
        */
      }
    },
    error => {
github abritopach / ionic-offline-mode / src / app / services / network.service.ts View on Github external
constructor(private toastController: ToastController, private loadingCtrl: LoadingController) {
    console.log('NetworkService::constructor | method called');

    let status = ConnectionStatus.Offline;
    if (Capacitor.platform === 'web') {
      console.log('WEB');
      console.log('navigator.onLine', navigator.onLine);
      this.addConnectivityListenersBrowser();
      status =  navigator.onLine === true ? ConnectionStatus.Online : ConnectionStatus.Offline;
    } else { // Native: use capacitor network plugin
      console.log('NATIVE');
      this.addConnectivityListernerNative();
      // status = Network.getStatus();
    }

    this.status.next(status);
  }
github abritopach / angular-ionic-ngxs-movies / src / app / pages / detail / detail.ts View on Github external
.subscribe(result => {
      if (result.items.length > 0) {
        console.log(result);
        const { videoId } = result.items[0].id;
        this.movie.videoId = videoId;

        // Code to use capacitor-youtube-player plugin.
        console.log('DetailsPage::watchTrailer -> platform: ' + Capacitor.platform);
        if (Capacitor.platform === 'web') {
          const componentProps = { modalProps: { item: this.movie}};
          this.presentModal(componentProps, YoutubeModalComponent);
        } else { // Native
          this.testYoutubePlayerPlugin();
        }

        /*
        if (Capacitor.platform === 'web') {
          window.open('https://www.youtube.com/watch?v=' + videoId);
        } else { // TODO: Use capacitor-youtube-player plugin.
          window.open('https://www.youtube.com/watch?v=' + videoId, '_blank');
        }
        */
      }
    },
github ModusCreateOrg / beep / src / helpers / index.js View on Github external
isIOS() {
    return Capacitor.platform === 'ios'
  },
}
github ModusCreateOrg / beep / src / helpers / index.js View on Github external
isWeb() {
    return Capacitor.platform === 'web'
  },