本文整理汇总了TypeScript中ionic-angular.Events类的典型用法代码示例。如果您正苦于以下问题:TypeScript Events类的具体用法?TypeScript Events怎么用?TypeScript Events使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Events类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: listenToGpsEvents
listenToGpsEvents() {
this.events.subscribe('gps:on', () => {
this.gpstracking = true;
});
this.events.subscribe('gps:off', () => {
this.gpstracking = false;
});
}
示例2: listenToLoginEvents
listenToLoginEvents() {
//fired when the user logs in
this.events.subscribe('user:login', () => {
this.loadStations();
});
this.events.subscribe('user:logout', () => {
if (this.stations) {
this.stations = null;
}
});
}
示例3: listenToLoginEvents
listenToLoginEvents() {
this.events.subscribe('user:login', (str) => {
this.rootPage = 'TabsPage';
this.initJpush();
});
this.events.subscribe('user:logout', (str) => {
this.nativeService.removeStorage('token');
this.loginModal = this.modalCtrl.create('LoginPage');
this.loginModal.present();
this.rootPage = 'TabsPage';
});
}
示例4:
this.auth.onAuthStateChanged((user: any) => {
if (user) {
this.events.publish('user:login');
} else {
events.publish('user:logout');
}
});
示例5: handlePayPro
private handlePayPro(payProDetails, url, coin?: Coin): void {
if (!payProDetails) {
this.logger.error('No wallets available');
const error = this.translate.instant('No wallets available');
this.events.publish('incomingDataError', error);
return;
}
const stateParams = {
amount: payProDetails.amount,
toAddress: payProDetails.toAddress,
description: payProDetails.memo,
paypro: payProDetails,
coin,
payProUrl: url,
requiredFeeRate: payProDetails.requiredFeeRate
? Math.ceil(payProDetails.requiredFeeRate * 1024)
: undefined
};
const nextView = {
name: 'ConfirmPage',
params: stateParams
};
this.events.publish('IncomingDataRedir', nextView);
}
示例6: subscribeToNameListChanges
private subscribeToNameListChanges() {
this.events.subscribe("admin:name:added", (data: Array<{uid: string, name: string, username: string}>) => {
let isSortingNeeded = false;
data.forEach((user) => {
if(user.uid !== this.firebaseService.getMyUid()) {
console.log("Adding:"+JSON.stringify(user));
this.nameList.push(user);
this.zone.run(() => this.nameClassifier.addToUserList(user));
isSortingNeeded = true;
}
});
if(isSortingNeeded) {
this.sortNameList();
}
});
this.events.subscribe("admin:name:changed", (data: Array<{uid: string, name: string, username: string}>) => {
let isSortingNeeded = false;
data.forEach((user) => {
let changedUser = this.nameList.find((iter)=> iter.uid === user.uid);
if(changedUser != null) {
changedUser.name = user.name;
changedUser.username = user.username;
console.log("updating user list");
this.zone.run(() => this.nameClassifier.updateUser(user));
isSortingNeeded = true;
}
});
if(isSortingNeeded) {
this.sortNameList();
}
});
}
示例7: goSend
private goSend(
addr: string,
amount: string,
message: string,
coin: Coin
): void {
if (amount) {
let stateParams = {
amount,
toAddress: addr,
description: message,
coin
};
let nextView = {
name: 'ConfirmPage',
params: stateParams
};
this.events.publish('IncomingDataRedir', nextView);
} else {
let stateParams = {
toAddress: addr,
description: message,
coin
};
let nextView = {
name: 'AmountPage',
params: stateParams
};
this.events.publish('IncomingDataRedir', nextView);
}
}
示例8: openPINModal
private openPINModal(action): void {
this.isModalOpen = true;
this.events.publish('showPinModalEvent', action);
this.events.subscribe('finishPinModalEvent', () => {
this.isModalOpen = false;
this.events.unsubscribe('finishPinModalEvent');
});
}
示例9: openFingerprintModal
private openFingerprintModal(): void {
this.isModalOpen = true;
let isCopay = this.appProvider.info.nameCase == 'Copay' ? true : false;
this.events.publish('showFingerprintModalEvent', isCopay);
this.events.subscribe('finishFingerprintModalEvent', () => {
this.isModalOpen = false;
this.events.unsubscribe('finishFingerprintModalEvent');
});
}
示例10:
this.liveStepSubscription.subscribe(buffer => {
let data = new Uint16Array(buffer);
this.events.publish('steps',data[0]);
/* For total steps, calculate how many steps to add as the current
step count minues the previous */
this.totalSteps += (data[0] - this.lastStepCount);
this.lastStepCount = data[0];
this.events.publish('totalsteps',this.totalSteps);
});