當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Platform.is方法代碼示例

本文整理匯總了TypeScript中ionic-angular.Platform.is方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Platform.is方法的具體用法?TypeScript Platform.is怎麽用?TypeScript Platform.is使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ionic-angular.Platform的用法示例。


在下文中一共展示了Platform.is方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: bledeviceChanged

 bledeviceChanged(value) {
   this.blescan = false;
   this.datastream = [];
   if (this.platform.is('mobile')) {
     BluetoothSerial.connect(value).then(
       value => {
         this.datastream.push("connect ok:" + JSON.stringify(value));
         console.log(value);
         this.watcher = BluetoothSerial.subscribe('\n').subscribe(
           (data) => {
             this.datastream.push("subscribe data:" + JSON.stringify(data));
             this.userData.setBluetoothData(data);
             console.log("subscribe data" + data);
           },
           (err) => {
             this.datastream.push("subscribe err:" + JSON.stringify(data));
             console.log("subscribeRaw err:" + data);
           }
         );
       },
       err => {
         this.datastream.push("connect err:" + JSON.stringify(err));
         console.error(err);
       }
     );
   } else {
     var data = '{\"id\":\"0000000001\",\"pr\":127,\"tp\":22.0,\"ba\":2.95}\r\n';
     this.datastream.push(JSON.stringify(data));
     this.userData.setBluetoothData(data);
   }
 }
開發者ID:maxamillion32,項目名稱:fleetany-mobile,代碼行數:31,代碼來源:bluetooth.ts

示例2: constructor

 constructor(
   public platform: Platform,
   public elementRef: ElementRef,
   public renderer: Renderer) {
   this.isAndroid = platform.is('android');
   renderer.setElementAttribute(elementRef.nativeElement, 'primary', this.isAndroid ? '' : null);
 }
開發者ID:GECOR,項目名稱:gecor-generic-2016,代碼行數:7,代碼來源:global.helpers.ts

示例3: openMenu

  openMenu() {
    let actionSheet = ActionSheet.create({
      title: 'Albums',
      cssClass: 'action-sheets-basic-page',
      buttons: [
        {
          text: 'Delete',
          role: 'destructive',
          icon: !this.platform.is('ios') ? 'trash' : null,
          handler: () => {
            console.log('Delete clicked');
          }
        },
        {
          text: 'Share',
          icon: !this.platform.is('ios') ? 'share' : null,
          handler: () => {
            console.log('Share clicked');
          }
        },
        {
          text: 'Play',
          icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
          handler: () => {
            console.log('Play clicked');
          }
        },
        {
          text: 'Favorite',
          icon: !this.platform.is('ios') ? 'heart-outline' : null,
          handler: () => {
            console.log('Favorite clicked');
          }
        },
        {
          text: 'Cancel',
          role: 'cancel', // will always sort to be on the bottom
          icon: !this.platform.is('ios') ? 'close' : null,
          handler: () => {
            console.log('Cancel clicked');
          }
        }
      ]
    });

    this.nav.present(actionSheet);
  }
開發者ID:Alucinante,項目名稱:ionic-preview-app,代碼行數:47,代碼來源:pages.ts

示例4: ionViewDidLoad

  ionViewDidLoad() {
    if (this.platform.is('cordova') === true) {
      let mapEle = document.getElementById('map_canvas');
      this.confData.getMap().subscribe(mapData => {
        this.map = new GoogleMap('map_canvas');
        mapEle.classList.add('show-map');

        GoogleMap.isAvailable().then(() => {
          mapData.find(data => {
            const position = new GoogleMapsLatLng(43.074395, -89.381056);

            this.map.animateCamera({
              target: position,
              zoom: 16
            }).then(() => {
              mapData.forEach(markerData => {
                const markerOptions: GoogleMapsMarkerOptions = {
                  position: markerData,
                  title: markerData.name
                };

                this.map.addMarker(markerOptions);
              });
            });
          });
        });
      });
    } else {
      this.confData.getMap().subscribe(mapData => {
        let mapEle = document.getElementById('map_canvas');

        let map = new google.maps.Map(mapEle, {
          center: mapData.find(d => d.center),
          zoom: 16
        });

        mapData.forEach(markerData => {
          let infoWindow = new google.maps.InfoWindow({
            content: `<h5>${markerData.name}</h5>`
          });

          let marker = new google.maps.Marker({
            position: markerData,
            map: map,
            title: markerData.name
          });

          marker.addListener('click', () => {
            infoWindow.open(map, marker);
          });
        });

        google.maps.event.addListenerOnce(map, 'idle', () => {
          mapEle.classList.add('show-map');
        });

      });
    }
  }
開發者ID:jgw96,項目名稱:ionic-conference-app,代碼行數:59,代碼來源:map.ts

示例5: reviewApp

 reviewApp() {
   if(this.platform.is('ios')) {
     window.open(`itms-apps://itunes.apple.com/app/viewContentsUserReviews/id1186113597`, '_system');
   }
   else {
     this.appRate.promptForRating(true);
   }
 }
開發者ID:jbw91,項目名稱:scripture-golf,代碼行數:8,代碼來源:about.ts

示例6:

 platform.ready().then(() => {
   // Okay, so the platform is ready and our plugins are available.
   // Here you can do any higher level native things you might need.
   if (platform.is('cordova')) {
     StatusBar.styleDefault();
     Splashscreen.hide();
   }
 });
開發者ID:yk,項目名稱:soggler,代碼行數:8,代碼來源:app.component.ts

示例7: openMenu

 openMenu() {
   let actionSheet = this.actionsheetCtrl.create({
     title: "Albums",
     cssClass: "action-sheets-basic-page",
     buttons: [
       {
         text: "Delete",
         role: "destructive",
         icon: !this.platform.is("ios") ? "trash" : null,
         handler: () => {
           console.log("Delete clicked");
         }
       },
       {
         text: "Share",
         icon: !this.platform.is("ios") ? "share" : null,
         handler: () => {
           console.log("Share clicked");
         }
       },
       {
         text: "Play",
         icon: !this.platform.is("ios") ? "arrow-dropright-circle" : null,
         handler: () => {
           console.log("Play clicked");
         }
       },
       {
         text: "Favorite",
         icon: !this.platform.is("ios") ? "heart-outline" : null,
         handler: () => {
           console.log("Favorite clicked");
         }
       },
       {
         text: "Cancel",
         role: "cancel", // will always sort to be on the bottom
         icon: !this.platform.is("ios") ? "close" : null,
         handler: () => {
           console.log("Cancel clicked");
         }
       }
     ]
   });
   actionSheet.present();
 }
開發者ID:alkunjo,項目名稱:ionic3,代碼行數:46,代碼來源:action-sheets.ts

示例8: blurActiveInput

  blurActiveInput() {
    if (!this.platform.is("iOS")) return;

    var activeElement:any = document.activeElement;
    if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") {
      activeElement.blur();
    }
  }  
開發者ID:radariii,項目名稱:inspector-app,代碼行數:8,代碼來源:login.ts

示例9: actuallyShow

 private actuallyShow(text) {
   if (this.platform.is('cordova')) {
     Toast.show(text, '1500', 'bottom').subscribe();
   }
   else {
     console.log(`Toast: ${text}`);
   }
 }
開發者ID:ActiverLtd,項目名稱:Mobile,代碼行數:8,代碼來源:toast.service.ts

示例10: createEditButton

 createEditButton(message, handler) {
   
   return {
       text: this.translate.instant(message),
       icon: !this.platform.is('ios') ? 'create' : null,
       cssClass: 'WorkoutAction-edit',
       handler
     } 
 }
開發者ID:vadzim-kazak,項目名稱:workout-log,代碼行數:9,代碼來源:workouts-actions.provider.ts


注:本文中的ionic-angular.Platform.is方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。