当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Platform.ready方法代码示例

本文整理汇总了TypeScript中@ionic/angular.Platform.ready方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.ready方法的具体用法?TypeScript Platform.ready怎么用?TypeScript Platform.ready使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ionic/angular.Platform的用法示例。


在下文中一共展示了Platform.ready方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: initializeApp

  initializeApp() {
    this.platform.ready().then(async () => {
      let defaultLanguage;

      if (this.platform.is('ios') || this.platform.is('android')) {
        defaultLanguage = (await this.globalization.getPreferredLanguage()).value.slice(0, 2);
        this.statusBar.styleLightContent();
        this.splashScreen.hide();
      } else {
        defaultLanguage = navigator.language.slice(0, 2);
      }

      // we assume that availableLanguage[0] is default language if user language is not available
      if (environment.availableLanguage && environment.availableLanguage.length > 0) {
        if (environment.availableLanguage.indexOf(defaultLanguage) === -1) {
          defaultLanguage = environment.availableLanguage[0];
        }
      } else {
        // or 'fr' if array is empty
        defaultLanguage = 'fr';
      }

      this.translate.setDefaultLang(defaultLanguage);

      this.settings.loadSettings();
      this.onlineTreks.loadTreks();
    });
  }
开发者ID:makinacorpus,项目名称:Geotrek-mobile,代码行数:28,代码来源:app.component.ts

示例2: exportCSV

 exportCSV() {
   this.platform.ready().then(readySource => {
     this.storage.getList().then(favList => {
       const file = `data:text/csv;charset=utf8,${json2csv.parse(favList)}`;
       this.export(file, 'csv', readySource);
     })
   })
 }
开发者ID:PierrePlessy,项目名称:pple_ultimateMovie,代码行数:8,代码来源:download.service.ts

示例3: initializeApp

 initializeApp() {
     this.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.
         this.statusBar.styleDefault();
         this.splashScreen.hide();
     });
 }
开发者ID:nickp10,项目名称:DFSStats,代码行数:8,代码来源:app.component.ts

示例4: exportJSON

 exportJSON() {
   this.platform.ready().then(readySource => {
     let file = 'data:text/json;charser=utf8,';
     this.storage.getList().then(favList => {
       favList.forEach(element => {
         file += `${JSON.stringify(element)}\n`;
       });
      this.export(file, 'json', readySource);
     })
   })
 }
开发者ID:PierrePlessy,项目名称:pple_ultimateMovie,代码行数:11,代码来源:download.service.ts

示例5: downloadPoster

 downloadPoster(poster: string, nameDownload: string) {
   if(!poster) return
   this.platform.ready().then(readySource => {
     if (readySource == "android" || readySource == "cordova") {
       const fileRoot = new File();
       this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE).then(res => {
         if (res.hasPermission) {
           const upload = this.fileTransfer.create();
           console.log(poster)
           upload.download(poster, `${fileRoot.externalRootDirectory}/Download/blob.jpg`)
           .then(foo => console.log("ok download poster", foo))
         }
       })
     }
   })
 }
开发者ID:PierrePlessy,项目名称:pple_ultimateMovie,代码行数:16,代码来源:download.service.ts

示例6: uploadFavorites

 uploadFavorites() {
   console.log("Upload");
   this.platform.ready().then(readySource => {
     if (readySource == "android" || readySource == "cordova") {
       this.fileChooser.open()
         .then(uri => {
           this.filePath.resolveNativePath(uri)
             .then(url => {
               const path = url.split('/');
               const filename = path.pop();
               const directory = `${path.join("/")}/`
               this.file.readAsText(directory, filename)
                 .then(res => {
                   if (url.endsWith(".json")) {
                     const newFav = new Array<Object>();
                     res.split("\n").forEach(element => {
                       if (element) newFav.push(JSON.parse(element))
                     })
                     this.storage.importFavorites(newFav);
                   }
                   else if (url.endsWith(".csv")) {
                     csv2json().fromString(res).then(resJSON => {
                       this.storage.importFavorites(resJSON);
                     })
                   }
                 })
                 .catch(err => {
                   console.log("Error read file export", err);
                 })
             })
         })
         .catch(err => {
           console.log("Error chooser", err)
         })
     }
   })
 }
开发者ID:PierrePlessy,项目名称:pple_ultimateMovie,代码行数:37,代码来源:upload.service.ts

示例7: initializeApp

 initializeApp() {
   this.platform.ready().then(() => {
     this.statusBar.styleDefault();
     this.splashScreen.hide();
   });
 }
开发者ID:dpa99c,项目名称:phonegap-launch-navigator-example,代码行数:6,代码来源:app.component.ts

示例8: initializeApp

 initializeApp() {
   this.platform.ready().then(() => {});
 }
开发者ID:bitjson,项目名称:bitcore,代码行数:3,代码来源:app.component.ts


注:本文中的@ionic/angular.Platform.ready方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。