当前位置: 首页>>代码示例>>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;未经允许,请勿转载。