本文整理匯總了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();
}
示例2: resolve
alert.onDidDismiss((_, role) => {
if (role === 'install') {
this.pro.deploy().redirect();
resolve(true);
} else {
resolve(false);
}
});
示例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,
});
}
示例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;
}
}
示例5: hasDeploy
async hasDeploy() {
if (!this.pro.deploy()) {
throw new Error('Deploy not loaded');
}
}
示例6: switchMap
switchMap(() => this.pro.deploy().extract()),