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


TypeScript Pro.deploy方法代码示例

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


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

示例1: initialize

  async initialize() {
    await this.platform.ready();
    await this.hasDeploy();

    await this.pro.deploy().init({
      appId: APP_ID,
      channel: this.settings.channel,
    });
    const versions = this.pro.deploy().getVersions();
    console.log(versions);
    // TODO: remove old versions
    this.platform.resume.subscribe(() => {
      this.checkForUpdates();
    });
    this.checkForUpdates();
  }
开发者ID:ifiske,项目名称:iFiske,代码行数:16,代码来源:deploy.ts

示例2: resolve

 alert.onDidDismiss((_, role) => {
   if (role === 'install') {
     this.pro.deploy().redirect();
     resolve(true);
   } else {
     resolve(false);
   }
 });
开发者ID:ifiske,项目名称:iFiske,代码行数:8,代码来源:deploy.ts

示例3: setChannel

  async setChannel(channel: string) {
    await this.platform.ready();
    this.settings.channel = channel;

    await this.hasDeploy();

    return this.pro.deploy().init({
      appId: APP_ID,
      channel,
    });
  }
开发者ID:ifiske,项目名称:iFiske,代码行数:11,代码来源:deploy.ts

示例4: checkForUpdates

  async checkForUpdates() {
    if (this.checking) {
      return;
    } else {
      this.checking = true;
    }

    try {
      await this.platform.ready();
      await this.hasDeploy();

      const hasUpdate = await Promise.race([
        this.pro.deploy().check(),
        new Promise((_, reject) => setTimeout(reject, 8000)),
      ]);

      console.log(hasUpdate);
      if (hasUpdate !== 'true') {
        return false;
      }

      switch (this.network.type) {
        // Don't update if the network type is slow (it probably costs a little bit)
        case Connection.CELL:
        case Connection.CELL_2G:
        case Connection.CELL_3G:
        case Connection.UNKNOWN:
        case Connection.NONE:
          this.network
            .onchange()
            .pipe(take(1))
            .subscribe(() => {
              this.checkForUpdates();
            });
          return false;

        case Connection.WIFI:
        case Connection.CELL_4G:
        default:
          break;
      }

      await this.pro
        .deploy()
        .download()
        .pipe(
          tap(status => console.log('Download status:', status)),
          filter(status => status === 'true' || status === 'done'),
          switchMap(() => this.pro.deploy().extract()),
          tap(status => console.log('Extract status:', status)),
          filter(status => status === 'true' || status === 'done'),
          take(1),
          timeout(30 * 1000),
        )
        .toPromise();

      if (this.settings.isDeveloper) {
        const alert = await this.alertCtrl.show({
          title: 'New update available',
          message: 'There is a new update available',
          buttons: [
            {
              text: 'Install',
              role: 'install',
            },
            {
              text: 'Postpone',
              role: 'cancel',
            },
          ],
        });

        return new Promise(resolve => {
          alert.onDidDismiss((_, role) => {
            if (role === 'install') {
              this.pro.deploy().redirect();
              resolve(true);
            } else {
              resolve(false);
            }
          });
        });
      }
      return false;
    } finally {
      this.checking = false;
    }
  }
开发者ID:ifiske,项目名称:iFiske,代码行数:88,代码来源:deploy.ts

示例5: hasDeploy

 async hasDeploy() {
   if (!this.pro.deploy()) {
     throw new Error('Deploy not loaded');
   }
 }
开发者ID:ifiske,项目名称:iFiske,代码行数:5,代码来源:deploy.ts

示例6: switchMap

 switchMap(() => this.pro.deploy().extract()),
开发者ID:ifiske,项目名称:iFiske,代码行数:1,代码来源:deploy.ts


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