本文整理汇总了TypeScript中ionic-angular.Events.subscribe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Events.subscribe方法的具体用法?TypeScript Events.subscribe怎么用?TypeScript Events.subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-angular.Events
的用法示例。
在下文中一共展示了Events.subscribe方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: openPINModal
private openPINModal(action): void {
this.isModalOpen = true;
this.events.publish('showPinModalEvent', action);
this.events.subscribe('finishPinModalEvent', () => {
this.isModalOpen = false;
this.events.unsubscribe('finishPinModalEvent');
});
}
示例2: 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');
});
}
示例3: constructor
constructor(private appCtrl: App, private navCtrl: NavController, private navParams: NavParams, private events: Events, private badge: Badge, private topicService: TopicService, private utilService: UtilService, private messageService: MessageService) {
this.tab = this.navParams.get('tab');
this.params = {
page: 1,
tab: this.tab || 'all',
limit: 20,
mdrender: false
}
events.subscribe('messageCount', (data) => {
this.messageCount = data;
});
events.subscribe('topicPush', (data) => {
this.topics.unshift(data);
});
events.subscribe('user', (data) => {
this.user = data;
});
}
示例4:
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.local.clear(); // use this when user logged out
// One time Login
this.local.get("siteConfig").then((value) => {
if (value) {
this.siteconfig.setConfig(JSON.parse(value));
this.loadData();
this.zone.run(() => {
if (value) {
this.rootPage = ListPage;
} else {
//this.rootPage = LoginPage;
}
});
}
else {
this.rootPage = LoginPage;
}
});
//End
StatusBar.styleDefault();
this.events.subscribe('login:success', (res) => {
this.loadData();
});
this.uniteMenu.getMenu().then((value) => {
this.pages = value;
});
this.events.subscribe('page:added', (res) => {
this.loadData();
});
this.events.subscribe('page:removed', (index) => {
this.uniteMenu.removeMenu(index[0]);
});
this.events.subscribe('page:updated', (res) => {
this.uniteMenu.updateMenu(res[0]);
});
});
示例5: constructor
constructor(public app: IonicApp,public platform: Platform, public menu: MenuController, public events: Events, public data: DataService, public http: HttpService) {
this.app = app;
this.menu = menu;
this.events = events;
// set our app's pages
this.pages = [
{ title: 'Accueil', component: HomePage, icon: 'calendar'},
{ title: 'Friends', component: HomePage, icon: 'log-in'},
{ title: 'Settings', component: SettingsPage, icon: 'person-add'},
{ title: 'Connexion', component: LoginPage, icon: 'log-in'},
];
// get if user is logged, go the home, if not show login page OR tutorial
data.get('isLogged').then((isLogged) => {
if (!isLogged) {
data.get('done_tutorial').then((done) => {
if (!done)
app.getComponent('nav').setRoot(TutorialPage);
else
app.getComponent('nav').setRoot(LoginPage);
});
}
else {
this.pages[3].title = "Deconnexion";
app.getComponent('nav').setRoot(HomePage);
}
});
// Register Events
events.subscribe('user.login', (response) => {
this.pages[3].title = "Deconnexion";
});
events.subscribe('user.logout', () => {
this.pages[3].title = "Connexion";
});
// Register payement key
if (typeof Stripe !== 'undefined')
Stripe.setPublishableKey('pk_test_bZGpr8BL8ew6VjEz7i5Izb8G');
}
示例6: constructor
constructor(public navCtrl: NavController,
public loader: RecipeService,
public popoverCtrl: PopoverController,
public events: Events) {
this.loadRecipes()
this.events.subscribe('refresh-recipes', () => {
console.log('REFRESHING RECIPES')
this.loadRecipes()
})
}
示例7: constructor
constructor(private nav: NavController, private navParam: NavParams, private events: Events) {
this.geofence = this.navParam.get('geofence');
console.log(Json.stringify(this.geofence));
this.farmName = this.geofence.notification.text;
events.subscribe('farm:details', (userEventData) => {
// userEventData is an array of parameters, so grab our first and only arg
this.farmName = userEventData[0].notification.text;
});
}
示例8: constructor
constructor(public navCtrl: NavController, public navParams: NavParams, public http: Http, public popoverCtrl: PopoverController, public events: Events, public loadingCtrl: LoadingController) {
this.date = new Date();
this.http.get("http://apollo_ror.slapps.fr/sources.json").map(res => res.json()).subscribe(data => {
this.sources = [];
//this.items = {};
console.log(data);
for(var i=0;i<data.length;i++){
//this.items[data[i].name]=data[i].display;
this.sources.push({
name: data[i].name,
display: data[i].display,
});
};
this.fetchNews(this.date);
/*
this.http.get("http://apollo_ror.slapps.fr/news.json").map(res => res.json()).subscribe(data => {
this.news = [];
console.log(data);
for(var i=0;i<data.length;i++){
this.news.push({
title: data[i].title,
source: data[i].source,
image_link: data[i].image_link,
datetime:new Date(data[i].date),
link:data[i].link
});
};
this.updateNews();
});
*/
});
events.subscribe('date:updated', (date) => {
this.fetchNews(date);
});
events.subscribe('sources:updated', () => {
this.updateNews();
});
}
示例9: constructor
constructor(public nav: NavController,
public ns: NoteService,
public events: Events) {
this.loadNotes();
events.subscribe("refreshNotes", () => {
this.loadNotes();
});
}
示例10: constructor
constructor(public events: Events) {
function createUser(user) {
console.log('User created!');
events.publish('user:created', user);
}
events.subscribe('user:created', (user) => {
console.log('Welcome', user);
});
createUser({ name: 'Feidianbo' });
}