本文整理匯總了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);
});