當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Events.subscribe方法代碼示例

本文整理匯總了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');
   });
 }
開發者ID:bitjson,項目名稱:copay,代碼行數:8,代碼來源:app.component.ts

示例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');
   });
 }
開發者ID:bitjson,項目名稱:copay,代碼行數:9,代碼來源:app.component.ts

示例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;
   });
 }
開發者ID:lqxlcc,項目名稱:Ionic2-CNodeClub,代碼行數:18,代碼來源:home.ts

示例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]);
      });
    });
開發者ID:appcarvers,項目名稱:joomla-articles-app,代碼行數:43,代碼來源:app.ts

示例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');
  }
開發者ID:vmarchaud,項目名稱:share_eat_mobile,代碼行數:43,代碼來源:app.ts

示例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()
   })
 }
開發者ID:,項目名稱:,代碼行數:10,代碼來源:

示例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;
    });
  }
開發者ID:nisinha,項目名稱:farmapp,代碼行數:10,代碼來源:farmdetails.ts

示例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();
        });
    }
開發者ID:stevenluong,項目名稱:apollo,代碼行數:42,代碼來源:list.ts

示例9: constructor

  constructor(public nav: NavController,
    public ns: NoteService,
    public events: Events) {

    this.loadNotes();

    events.subscribe("refreshNotes", () => {
      this.loadNotes();
    });

  }
開發者ID:ntancardoso,項目名稱:noted,代碼行數:11,代碼來源:notes.ts

示例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' });
 }
開發者ID:feidianbo,項目名稱:ionic2-demo,代碼行數:11,代碼來源:page3.ts


注:本文中的ionic-angular.Events.subscribe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。